Azzera filtri
Azzera filtri

read and show text files in GUI MATLAB

4 visualizzazioni (ultimi 30 giorni)
Muhammad
Muhammad il 12 Ago 2013
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 Commenti
Muhammad
Muhammad il 12 Ago 2013
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

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by