DIR Index exceeds number of array elements

9 ビュー (過去 30 日間)
Lmm3
Lmm3 2022 年 12 月 15 日
コメント済み: Lmm3 2022 年 12 月 15 日
In the script below, I am trying to read-in all of the files in the folder that have the extension '.bmp'. I would then like to find the Min value from the .bmp file. I would appreciate help with understanding the following error I am receiving. Thank you.:
Index exceeds the number of array elements. Index must not exceed 49.
Error in untitled (line 2)
fileList = dir('*.bmp');
clear(); dir = pwd;
fileList = dir('*.bmp');
for i = 1:length(fileList)
A1 = imread(files(i).name);
A1_NoZero = A1;
A1_NoZero(find(A1_NoZero==0))=2560;
Min_A1 = min(min(A1_NoZero))
end

採用された回答

Stephen23
Stephen23 2022 年 12 月 15 日
Problem: you have created a variable named DIR, here on this line:
dir = pwd;
Solution: get rid of that line of code and clear the workspace.
  1 件のコメント
Lmm3
Lmm3 2022 年 12 月 15 日
@Stephen23 That corrected the error. Thank you so much.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by