UNDEFINED VARIABLE ERROR AFTER EXECUTING FOR LOOP IN MATLAB
11 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (2 件)
Walter Roberson
2019 年 4 月 24 日
You did not initialize columnMatrix, and numel(listOfImages) was 0.
0 件のコメント
Aybüke Ceren Duran
2019 年 4 月 24 日
1 件のコメント
Walter Roberson
2019 年 4 月 24 日
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.
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!