MATLAB Answers

MATLAB GUI

1 view (last 30 days)
ANUBHAV SINHA
ANUBHAV SINHA on 28 Jan 2011
Hi
It is intended that on basis of the number of rows and columns inputted by user, MATLAB should itself construct a tabular GUI in which numbers could be entered and thereafter, on pushing a 'push-button', some other specified job is execute. Any idea about how to 'auto'-generate a table in GUI?
Having constructed some straight forward GUIs using GUIDE (and thereafter programming it's m-files), I am relatively new and hav no clue abt this problem.
Thanks for your time.
  1 Comment
Siddharth Shankar
Siddharth Shankar on 30 Jan 2011
It is a good idea to provide more descriptive titles for your questions, such as "How to use a table in a MATLAB GUI (R2007a)".

Sign in to comment.

Answers (5)

Siddharth Shankar
Siddharth Shankar on 30 Jan 2011
As Matt mentioned, UITABLE wasn't really supported/documented till R2008a and was not (in 7a) nearly as powerful as it is today. There are plenty of workarounds:
There are also plenty of posts about this on the Newsgroup. One such post is here:
Most of these are undocumented/unsupported solutions, but should enable you to do what you need in R2007a. Best of luck.
  1 Comment
Siddharth Shankar
Siddharth Shankar on 30 Jan 2011
Just to clarify, with the 2nd link (the one alluding to the javacomponent command), I was trying to say that you should try using a JTABLE in your MATLAB figure if you're comfortable with Java.

Sign in to comment.


Matt Fig
Matt Fig on 28 Jan 2011
Would UITABLE be what you want?

Walter Roberson
Walter Roberson on 28 Jan 2011
This would sound like a job for uitable(), if you are using a version new enough to have a documented uitable() . Which Matlab version are you using?

ANUBHAV SINHA
ANUBHAV SINHA on 30 Jan 2011
Version 7.4.0 R2007a

Matt Fig
Matt Fig on 30 Jan 2011
UITABLE was available in 2007a, for example:
T = uitable('NumColumns',4,'NumRows',6,'position',[10 10 400 300]);
Now to see the properties of T, try get(T). Beware that this was experimental back then and has changed. Even some of the property names have changed. Here is the current documentation.
Another option would be to create an array of editable textboxes, if the expected number of rows and columns is not too large (or could be programatically limited).
figure('position',[400 400 120 120],...
'menubar','none')
P = [10 10 45 20];
for ii = 1:2
for jj = 1:3
T(ii) = uicontrol('style','edit',...
'position',P + [55*(ii-1) 40*(jj-1) 0 0]);
end
end

Community Treasure Hunt

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

Start Hunting!

Translated by