Error using imfinfo()
조회 수: 17 (최근 30일)
이전 댓글 표시
Every time I run this code it says that for some reason there is an error in line 142 of the function imfinfo:
filename=uigetfile('*.tif');
[r c]=size(imfinfo(filename));
for i = 1:r
rgb = imread(filename, i);
set(handles.textSlidenumber, 'String', i);
status = get(radiobuttonRBG, 'Value');
if status
imshow(rgb);
else
gray = rgb2gray(rgb);
imshow(gray);
end
line 142 in imfinfo is:
error(message('MATLAB:imagesci:imfinfo:fileOpen', filename));
댓글 수: 0
답변 (1개)
Walter Roberson
2020년 4월 22일
filename=uigetfile('*.tif');
The output you get from that call will not include any directory information. If the user chooses something that is not in the current directory, you will have difficulty.
[filename, pathname] = uigetfile('*.tif');
if ~ischar(filename)
%user canceled
return
end
filename = fullfile(pathname, filename);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Numeric Types에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!