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 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