MATLAB GUI

1 次查看(过去 30 天)
ANUBHAV SINHA
ANUBHAV SINHA 2011-1-28
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 个评论
Siddharth Shankar
Siddharth Shankar 2011-1-30
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)".

请先登录,再进行评论。

回答(5 个)

Siddharth Shankar
Siddharth Shankar 2011-1-30
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 个评论
Siddharth Shankar
Siddharth Shankar 2011-1-30
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.

请先登录,再进行评论。


Matt Fig
Matt Fig 2011-1-28
Would UITABLE be what you want?

Walter Roberson
Walter Roberson 2011-1-28
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 2011-1-30
Version 7.4.0 R2007a

Matt Fig
Matt Fig 2011-1-30
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

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by