Save data in jpg format in special folder

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Printing and Saving 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by