UNDEFINED VARIABLE ERROR AFTER EXECUTING FOR LOOP IN MATLAB
11 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
for k=1:numel(listOfImages)
data{k}=imread(fullfile(whereImagesReside, listOfImages(k).name));
data{k}=im2double(rgb2gray(data{k}));
[r,c] = size(data{k}); % get number of rows and columns in image
columnMatrix(:,k)=data(:);
V{k}=data(:);
end
meanIntensities = mean(columnMatrix,2);
But I get the error Undefined function or variable 'columnMatrix'. How can I solve this?
0 Commenti
Risposte (2)
Walter Roberson
il 24 Apr 2019
You did not initialize columnMatrix, and numel(listOfImages) was 0.
0 Commenti
Aybüke Ceren Duran
il 24 Apr 2019
1 Commento
Walter Roberson
il 24 Apr 2019
The empty structure array from dir is the more immediate problem. You should try putting the complete path in the variable about where the images reside.
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!