Info

此问题已关闭。 请重新打开它进行编辑或回答。

help with this basic matlab code..

1 次查看(过去 30 天)
YJ
YJ 2014-10-8
关闭: MATLAB Answer Bot 2021-8-20
Here is a code I wrote,
I want the each file to be cut off
I got right up to cut_2 bit.
But problem comes in Mean_process_cut_cut_image_posi = rot90(cut_2,3);
I want to rotatte the image and want to call it as Mean_process_cut_cut_image_posi
But when I run, in a workspace it only shows
Mean_process_image_pos1
....
Mean_process_image_pos5
and
Mean_process_cut_cut_image_posi
whereas I want to have
Mean_process_cut_cut_image_pos1
Mean_process_cut_cut_image_pos2
Mean_process_cut_cut_image_pos3
I think this should be easy bit... but I am stuck at this for an hour..
Here is my code.
files = dir('*.mat');
for i=1:5
load((['Mean_process_image_pos',num2str(i),'.mat']));
%load(files(i).name);
cut_1 = rot90(Mean_process_image_pos1, 3);
x = 193; %10mm
y = 768 -x;
cut_2 = cut_1(:,x:y);
Mean_process_cut_cut_image_posi = rot90(cut_2,3);
end
stacked_cut_image= [ Mean_process_cut_cut_image_pos5;Mean_process_cut_image_pos4;Mean_process_cut_image_pos3;Mean_process_cut_image_pos2;Mean_process_cut_image_pos1];

回答(1 个)

Iain
Iain 2014-10-8
The answer you're looking for is actually really really really horrible:
Mean_process_cut_cut_image_posi = rot90(cut_2,3);
Should be:
eval(['Mean_process_cut_cut_image_pos' num2str(i) ' = rot90(cut_2,3);']);
But that is awful matlab. You should replace it with:
stacked_cut_image(i,:) = rot90(cut_2,3);
  1 个评论
YJ
YJ 2014-10-8
When I sub
stacked_cut_image(i,:) = rot90(cut_2,3);
instead of
Mean_process_cut_cut_image_posi = rot90(cut_2,3);
I got an error message..

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by