Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Putting up graphic from directory to axes 1

  • Thread starter Thread starter -
  • Start date Start date
Status
Not open for further replies.

Guest
Dear everyone,
I am new to matlab so I hope that I can get some guidance from you guys. I am now using matlab version 6 to do a GUI. All I need to do is to select a name in the popup menu and the graphic can display on the axes from my C drive where I stall my picture. Hope that I can hear from you guys soon.

Thank a million
Lina
 
Hi,
Here is what you have to do:
1) Allow the user to select a file of a given type and catch the name and directory using 'uigetfile' Matlab GUI. The command is for example:
[FILENAME, PATHNAME] = UIGETFILE('*.tif', 'Choose image')
2) Load the image into a matrix using 'imread' Matlab function:
M=imread([PATHNAME '\' FILENAME],'jpg') ;
M can be a structure with two fields (Intensity and colorspec) or 3D matrix depends on the image type. Chack it yourself.
or
[M,C]=imread([PATHNAME '\' FILENAME],'tif') ; to get the intensity and colorspec in two different matrices. Check the help.
3) display the image using 'imshow' command:
imshow(M,C)
or
imshow(M.data,M.color)
or
imshow(M,[])
depends on image type.
put all this in a script file' My_first_try.m' for example.
See:
>> help uigetfile
>>help imread
>> help imshow
for details.
Joe
BSTEX-Equation viewer for Matlab
 
hi joe,
I've just designed a GUI in Matlab V6.01 to simulate a simulink model. I'm having the trouble of showing the graphics on the axes of the GUI when i press the start button on the GUI. In short, how can I program the GUI to show the graph as it can be shown by the scope in Simulink?

thanks, Kirby
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top