im trying to make array of images s1,s2,s3 and s4 and want to show them in different figures ........... what is wrong over there? .........

2 ビュー (過去 30 日間)
clc close all clear all arr={s1,s2,s3,s4}; for i=1:4 b=imread(arr{i}); figure,imshow(arr{i}); end

採用された回答

Iman Ansari
Iman Ansari 2013 年 6 月 5 日
編集済み: Iman Ansari 2013 年 6 月 5 日
clear
arr={s1,s2,s3,s4};
for i=1:4
b=imread(arr{i});
figure
imshow(b);
end
  2 件のコメント
moniba qureshi
moniba qureshi 2013 年 6 月 5 日
still same error........"??? Undefined function or variable 's1'." however s1 is image saved in work area
Iman Ansari
Iman Ansari 2013 年 6 月 5 日
編集済み: Iman Ansari 2013 年 6 月 5 日
What is its extension? '.jpg' , '.tif' , '.png' , '.gif'
full file names:
arr={'s1.jpg','s2.tif','s3.png','s4.gif'};

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2013 年 6 月 5 日
s1, s2, s3, and s4 need to be strings that contain the actual filenames. If you do that, it will work. For example:
% Define the filenames:
s1 = 'moon.tif';
s2 = 'cameraman.tif';
s3 = 'peppers.png';
s4 = 'football.jpg';
arr={s1,s2,s3,s4};
% Display each in a new figure.
for i=1:4
b=imread(arr{i});
figure;
imshow(arr{i});
end

Community Treasure Hunt

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

Start Hunting!

Translated by