From: marwen on
Hi everybody,
Please i am still beginner with Matlab and i have an exam after tomorrow.
The exercise is to :
create an interface-->Create a button "open a file"-->So when we clic on this button-->a window will appear to choose an image -->then the chosen picture should appear in the same interface.
That is it men!!
Please help me.
I need you.
Your friend from Spain
From: Nathan on
On May 11, 4:29 pm, "marwen " <hi.mar...(a)gmail.com> wrote:
> Hi everybody,
> Please i am still  beginner with Matlab and i have an exam after tomorrow.
> The exercise is to :
>  create an interface-->Create a button "open a file"-->So when we clic on this button-->a window will appear to choose an image -->then the chosen picture should appear in the same interface.
> That is it men!!
> Please help me.
> I need you.
> Your friend from Spain

doc figure
doc uigetfile
doc uicontrol
doc axes
doc imshow

-Nathan
From: marwen on
Actually this is what i did until now:

function [] = GUI_1()
clc
S.fh = figure('units','pixels',...
'position',[300 300 300 300],...
'menubar','none',...
'numbertitle','off',...
'name','GUI_10',...
'resize','off');
S.ay = axes('units','pixels',...
'position',[20 50 160 140]);
S.im = load('clown'); % This is a built-in ML example.
colormap(S.im.map); % Set the figure's colormap.
S.R = image(S.im.X); % Display the image on S.ax.

set(S.ay,'xtick',[],'ytick',[]) % Get rid of ticks: avoid the scale of the image.
S.pb = uicontrol('style','push',...
'units','pixels',...
'position',[10 10 180 30],...
'fontsize',14,...
'string','INVISIBLE/VISIBLE',...
'callback',{@pb_call,S});


var S.result;
function [] = pb_call(varargin)
% Callback for the pushbutton.
S = varargin{3}; % Get the structure.
[filename1,pathname1, filterindex] = uigetfile(...
{'marwen(*.jpg,*.Rh)';...
'*.m'},...
'Select the file you want to visualize','MultiSelect', 'on');
if isequal(filename1,0)
disp('User selected Cancel')
else
S.result=fullfile(pathname1, filename1);
S.im=imread(S.result);
end

But i don't know what to do after that ...
Please help
From: Nathan on
On May 11, 5:08 pm, "marwen " <hi.mar...(a)gmail.com> wrote:
> Actually this is what i did until now:
>
> function [] = GUI_1()
> clc
> S.fh = figure('units','pixels',...
>               'position',[300 300 300 300],...
>               'menubar','none',...
>               'numbertitle','off',...
>               'name','GUI_10',...
>               'resize','off');
> S.ay = axes('units','pixels',...
>             'position',[20 50 160 140]);
> S.im = load('clown');  % This is a built-in ML example.
> colormap(S.im.map);  % Set the figure's colormap.
> S.R = image(S.im.X);  % Display the image on S.ax.
>
> set(S.ay,'xtick',[],'ytick',[])  % Get rid of ticks: avoid the scale of the image.
> S.pb = uicontrol('style','push',...
>                  'units','pixels',...
>                  'position',[10 10 180 30],...
>                  'fontsize',14,...
>                  'string','INVISIBLE/VISIBLE',...
>                  'callback',{@pb_call,S});
>
> var S.result;            
> function [] = pb_call(varargin)
> % Callback for the pushbutton.
> S = varargin{3};  % Get the structure.
> [filename1,pathname1, filterindex] = uigetfile(...
>     {'marwen(*.jpg,*.Rh)';...
>     '*.m'},...
>     'Select the file you want to visualize','MultiSelect', 'on');
> if isequal(filename1,0)
>    disp('User selected Cancel')
> else
>    S.result=fullfile(pathname1, filename1);
>    S.im=imread(S.result);
>   end
>
> But i don't know what to do after that ...
> Please help

Well, wouldn't you want to also show the image you just read in?

Ex:
After you read the image in the pushbutton callback:
imshow(S.im);


You might want to change more of this file, as I can easily tell that
you ripped it off of Matt Fig's GUI_10.

-Nathan
From: marwen on
Yes that is true man,it isn't mine,i add just "how to load the file from windows"!!
and it isn't this conversation what i am looking for.
i don't know how can i call the axe in the declaration of the function and put the new image in it.
So this is my problem right now.
i think just there are two commands missing that is it.
Please help i have less than 24h before sitting for the exaaam.