Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

help with this basic matlab code..

조회 수: 2 (최근 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