---
# System prepended metadata

title: csv轉jpg
tags: [matlab]

---

# csv轉jpg

###### tags: `matlab`

```
%讀取目標資料夾所有的檔名
fileFolder=fullfile('C:\Users\bobo\Desktop\all data\國立台北科技大學\paper\張浩 Learning to Group Discrete Graphical Patterns\TrainData\test_element\');%資料夾名plane
dirOutput=dir(fullfile(fileFolder,'*'));%如果存在不同型別的檔案，用‘*’讀取所有，如果讀取特定型別檔案，'.'加上檔案型別，例如用‘.jpg’
fileNames={dirOutput.name};
```
```
for i = 3:18
    string = "C:\Users\bobo\Desktop\all data\國立台北科技大學\paper\張浩 Learning to Group Discrete Graphical Patterns\TrainData\test_element\"+fileNames(1,i) %目標資料夾
    file = csvread(string)
    gcf = figure(i)
    imshow(file)
    string2 = fileNames(1,i)
    string3 = split(string2,".")
    string4 = string3(1,1)+".jpg"
    saveas(gcf,string4)
    close
end
```