How do I imread stimuli from a randomised array
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Laura Proctor
le 18 Avr 2011
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 commentaires
Laura Proctor
le 20 Avr 2011
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.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Convert Image Type dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!