필터 지우기
필터 지우기

read and show text files in GUI MATLAB

조회 수: 4 (최근 30일)
Muhammad
Muhammad 2013년 8월 12일
Hi EveryBody
hope you all are enjoying good health. i have 55 '*.text' files.every file contain image data and these are in folder (Image files). i want to see these images in axis using a pushbutton in GUI MATLAB. i am using the code
for k = 1:55
textFilename = ['text' num2str(k) '.txt'];
fid = fopen(textFilename, 'rt');
textData = fread(fid);
fclose(fid);
disp (textData);
end
i want to see the images using a slider.
any help is appreciated please.
Muhammad Isa.
  댓글 수: 2
Muhammad
Muhammad 2013년 8월 12일
Hello Dear respected Walter
thank you for your tips. i tried this code according to your tips as given below.
function D3_D_Callback(hObject, eventdata, handles)
myFolder = 'C:\Users\khanm\Desktop\image files';
if ~isdir (myFolder)
errorMessage = sprintf ('Error: The following folder does not exist:\n%s',myFolder);
uiwait (warndlg (errorMessage));
return;
end
filePattern = fullfile (myFolder, '*text');
textFiles = dir (filePattern);
for k= 1:6
baseFileName = textFiles(k) .name;
fullFileName = fullFile (myFolder, baseFileName);
fprintf (1, 'Now reading %s\n', fullFileName);
imageArray = imread(fullFileName);
imshow(imageArray); %display image.
drawnow;
end
when i run the GUI the i found error on command window given below
**Index exceeds matrix dimensions.
Error in Text>D3_D_Callback (line 87)
baseFileName = textFiles(k) .name;
Error in gui_mainfcn (line 96) feval(varargin{:});
Error in Text (line 42) gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)Text('D3_D_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uimenu Callback**_
i wanna show all the images one by one using slider or push button but i am still unable to found the image.
isa

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Language Support에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by