How to use a for loop using contourfmap method ?

1 view (last 30 days)
S Ch
S Ch on 25 Jun 2021
Edited: S Ch on 25 Jun 2021
Hello,
I used the contourfcmap and I directly chose the number of levels I want, unfortunately I'm struggling to do a loop of 100 images using this method ! anyone can help me please?
To explain the problem, I have 100 matrices in a folder (each matrix is an image that I want to contourfmap) and after that save them in a folder as images with the colors I chose in contourfmap. Is this possible ?
This is my code:
for i = 1:N
%names is the char name of all matrices
if i < 10
names(i,:) = strcat("X_t0000",string(i),".mat");
else
names(i,:) = strcat("X_t000",string(i),".mat");
end
% A = eval(names);%(i,:)) ;
%After that I didn't know how to use names so I change to this follows:
Data= load(F(i).name);
z=Data.data; %iside each matrix there is matrix named 'data'
h1 = contourfcmap(v,x,z,[0.1 0.33],jet(1),[.1 .1 .1], [.9 .9 .9], 'eastoutside')
d = h1.c
l=h1.h
export_fig(fullfile(Folder, sprintf('%05d.png', i)))
%%% Here I had only one image appeared I think the last one.
% imwrite(d,fullfile(Folder, sprintf('%05d.png', i)))
% A = cat(3,names); %Here I wanted to concatenate the 100 matrices into
% one like 2048x2048x100 but I didn't succed
end
If it isn't clear please tell me to explain more. Thank you in advance.
S.C

Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!