Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
How to get GUI output in seperate Tabular form window

Subject: How to get GUI output in seperate Tabular form window

From: Pranav

Date: 28 Jun, 2011 10:12:02

Message: 1 of 3

Hello All,

I am a student and doing some calculations through GUI data input and want to display output (8 diffrerent variables) is in seperate window which must be in tabulare form. Can anybody have an idea ? Please help me out on urgent basis..
--
Regards

Subject: How to get GUI output in seperate Tabular form window

From: Sadik

Date: 29 Jun, 2011 00:40:12

Message: 2 of 3

Hi Pranav,

You can do something like this:

h = figure;
width = 100;
height = 17;
x = 10;
y = 10;

uicontrol(h,'style','text','units','pixels','string','var1','position',[x y width height]);

Since you have 8 variables, you are going to put 8 pairs of text objects [total 16]. The above line starting with uicontrol gives you the idea. Now you need to use a for loop to change x and y for each text object to construct your "table" using text objects.

However, you can also use uitable if it serves your purpose. An example from the documentation [help uitable]:

f = figure('Position',[200 200 400 150]);
dat = rand(3);
cnames = {'X-Data','Y-Data','Z-Data'};
rnames = {'First','Second','Third'};
t = uitable('Parent',f,'Data',dat,'ColumnName',cnames,...
            'RowName',rnames,'Position',[20 20 360 100]);

Best.

Subject: How to get GUI output in seperate Tabular form window

From: Pranav

Date: 29 Jun, 2011 07:16:09

Message: 3 of 3

Thanks a lot. your second method works and fulfilling my requirements.
Best...

"Sadik " <sadik.hava@gmail.com> wrote in message <iuds9c$7mi$1@newscl01ah.mathworks.com>...
> Hi Pranav,
>
> You can do something like this:
>
> h = figure;
> width = 100;
> height = 17;
> x = 10;
> y = 10;
>
> uicontrol(h,'style','text','units','pixels','string','var1','position',[x y width height]);
>
> Since you have 8 variables, you are going to put 8 pairs of text objects [total 16]. The above line starting with uicontrol gives you the idea. Now you need to use a for loop to change x and y for each text object to construct your "table" using text objects.
>
> However, you can also use uitable if it serves your purpose. An example from the documentation [help uitable]:
>
> f = figure('Position',[200 200 400 150]);
> dat = rand(3);
> cnames = {'X-Data','Y-Data','Z-Data'};
> rnames = {'First','Second','Third'};
> t = uitable('Parent',f,'Data',dat,'ColumnName',cnames,...
> 'RowName',rnames,'Position',[20 20 360 100]);
>
> Best.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us