How do I imread stimuli from a randomised array
8 ビュー (過去 30 日間)
古いコメントを表示
I tried reading stimulus image into matlab matrix but get receiving error message saying the file does not exist. Here is my code:
files = dir('D:\picture\*.jpg'); %folder name is stimuli
trial = 0;
nTrial = 10;
for trial=1:nTrial
stimfilename=strcat('D:\picture\',char(tArray(trial,3))) imdata=imread(char(stimfilename));
end
I ran the above code and it returns stimfilename as D:\picture\J123jpg. However, it vomits an error message
??? Error using ==> imread at 372
File "D:\picture\J123jpg" does not exist.
Please any help will be highly appreciated. Thanks in advance.
Tom
0 件のコメント
採用された回答
Laura Proctor
2011 年 4 月 18 日
You may wish to try by simplifying the code a bit. Try the following lines to see if you still get the same error message.
files = dir('D:\picture\*.jpg'); %folder name is stimuli
for trial=1:length(files)
stimfilename=['D:\picture\',files(trial).name];
imdata=imread(char(stimfilename));
end
5 件のコメント
Laura Proctor
2011 年 4 月 20 日
The error message shows that the file name is J123jpg, but not J123.jpg as one might expect. Can you go into the directory D:\picture and just try imread('J123.jpg') to see if the image can be read without the other code? If that works, try the following lines:
files = dir('D:\picture\*.jpg');
stimfilename=['D:\picture\',files(1).name]
imdata = imread(stimfilename)
To see if it can read just the first file.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Convert Image Type についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!