Can I make a Pushbutton create a new Table?

What I'm trying to do is: When I press a Pushbutton - a Table will be created on the Panel. Is it possible?

 채택된 답변

Image Analyst
Image Analyst 2013년 2월 11일

1 개 추천

Why not just have the table there already in the panel? You can make it visible or not by doing
set(handles.panel1, 'visible', 'on');
You can send data to the table by doing
set(handles.table1, 'Data', yourDataArray);

댓글 수: 3

Chris Dan
Chris Dan 2020년 7월 8일
Hi, I understood the first line of code,
Can you tell how the second line of code does?
is it the same?
Not sure what else to say. It takes your data, for example a double array or cell array called yourDataArray, and puts it into the table (spreadsheet) on the GUI so that the table now appears with the current values that are in your array. Basically what I said "send data to the table".
By the way, the new OOP way of doing it is:
handles.panel1.Visible = 'on'; % Make sure table is visible (not hidden/invisible).
handles.table1.Data = yourDataArray; % Send current values in variable yourDataArray to the table on the GUI.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Jan
Jan 2013년 2월 11일
편집: Jan 2013년 2월 11일

0 개 추천

Yes.
What have you tried so far and did any problems occur? You can either create the table dynamically by calling the uitable command, of you can create the table statically e.g. in GUIDE and make it invisible at first, such that the callback of the button set the visibility to 'on' only.

댓글 수: 2

Nimrodb
Nimrodb 2013년 2월 11일
I do not know how to begin or try anything. I presume that I need to go to the Pushbutton Callback function and write there the "create a table" function - but I have no Idea how to do that nor the syntax
Jan
Jan 2013년 2월 11일
Simply insert the command uitable there and look what happens. You find many examples in the net, when you search for "Matlab uitable".

댓글을 달려면 로그인하십시오.

Nimrodb
Nimrodb 2013년 2월 11일

0 개 추천

I'll try. Thanks. What about the option of building the table only when the button is pushed? Is that possible?

댓글 수: 1

Image Analyst
Image Analyst 2013년 2월 11일
Try what? Whose answer were you commenting on? This is why it's good to reply to a specific person's answer rather than posting your follow up question as an Answer in itself.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

2013년 2월 11일

댓글:

2020년 7월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by