UNDEFINED VARIABLE ERROR AFTER EXECUTING FOR LOOP IN MATLAB
1 次查看(过去 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 个)
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 中查找有关 File Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!