Save data in jpg format in special folder

1 回表示 (過去 30 日間)
khadicha amonova
khadicha amonova 2019 年 3 月 19 日
編集済み: khadicha amonova 2019 年 3 月 19 日
Hello.
I wanted to make imagedatastore from .mat file.,(it consist of 1x1 struct:Data with 150x10000double and Labels with 150x1cell.)
My target was save figures in special format(for example, .j,pg, 224x224pixel) in special folder. Actually there are 3 subfolder(name of 3 category).
So i tried codes like this
load(fullfile(tempdir,'ECG','Data.mat')
parentDir = tempdir
dataDir = 'data'
imageRoot = fullfile(parentDir,)dataDir;
data = Data.Data
labels = Data.Labels
r = size(data,1)
for i = 1:r
cfs = abs(data(i,1:1000)
im = ind2rgb(im2uint8(rescale())cfs,jet(128))
imgLoc= fullfile(imageroot,char(labels()))i
imFileName= strcat(char(labels(i)),'_',num2str()i,''jpg)
imwrite(imresize(im,[224 224],fullfile(imgLoc,))
end
imFileName
  1 件のコメント
khadicha amonova
khadicha amonova 2019 年 3 月 19 日
編集済み: khadicha amonova 2019 年 3 月 19 日
Furthermore, at the beginning I wanted to use plot and saveas function. But unfortunately There no possiblity to save in special folder automatically in saveas funtion.
At the result I used abow mentioned code and I get jpg files with terrible images! They look very strange! ?
only one things makes me happy that they are located in proper folders!,?
How I can plot my signal (there are150 signal data in one .mat file) and save them in proper folder automatically!
Please help me

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangePrinting and Saving についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by