フィルターのクリア

problems with a for loop within a switch statement

1 回表示 (過去 30 日間)
Neo
Neo 2015 年 7 月 28 日
コメント済み: Walter Roberson 2015 年 7 月 30 日
I am creating a code where there is a for loop within a switch statement. I want the switch statement in there because I want to evaluate an expression, (SSIM), then for each time it is evaluated I want it to pick out values between 0 to 1 or from -1 to 1. But I am having trouble, and am not sure, how to set this up. Here is what I have so far:
ref = picture2
A = picture1
subplot(1,2,1); imshow(ref); title('Mode 1');
subplot(1,2,2); imshow(A); title('Mode 2');
fprintf('The SSIM value is %0.4f.\n',ssimval);
switch [ssimval, ssimmap] = ssim(A,ref);
case i := 1:
for i from 0 to 1 do
a := <i;
fprintf('The SSIM value is %0.4f.\n',ssimval);
figure, imshow(ssimmap,[]);
title(sprintf('ssim Index Map - Mean ssim Value is %0.4f,',ssimval));
otherwise
title(sprintf('ssim Index Map - Mean ssim Value is %0.4f does not fit within criteria,',ssimval));
end
Any suggestions? Thanks to all and to all a good night (except for the best Answerer :p) - Neo

採用された回答

Walter Roberson
Walter Roberson 2015 年 7 月 29 日
http://www.mathworks.com/help/matlab/ref/for.html (and notice you must end the loop)
I do not know what the intention is for your line
a := <i;
Perhaps you wanted assignment, but the "<i" part is a mystery. "<" looks like one of the relational operators but those require a value on each side of the symbol.
  6 件のコメント
Neo
Neo 2015 年 7 月 30 日
I'm actually referring to the former a. That is what I wanted.
Walter Roberson
Walter Roberson 2015 年 7 月 30 日
i(i >=0 & i <= 1) is an example of logical indexing. You define a test for the values you want to keep, resulting in a vector of true/false values. Indexing something with true and false selects the elements where the index is true.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by