Why is GUIDE not allowing me to have one (1) column and three (3) rows in my table? It seems as if the default table is 4 x 2

 채택된 답변

In the table's createFcn add the following line:
set(handles.table1,'Data',cell(3,1));
Where table1 is the 'Tag' of your table.

댓글 수: 12

This error message occured:
Attempt to reference field of non-structure array.
Error in MasterSet>table1_CreateFcn (line 104)
set(handles.table1, 'Data', cell(3,1));
interesting... What is being referenced in the createfcn?
perhaps:
set(hObject,'Data',cell(3,1))
?
the program ran without any errors; however, I still dont have a 3,1 table.
@Sean - I think the handles structure has yet to be assembled when the CreateFcn is sent to?
You're right Tom.
@Cordelle, I'm surprised it did not take. What if you move:
set(handles.table1,'Data',cell(3,1));
To the GUI's OutputFcn.?
same result, still not able to get a 3x1 table
Try running this in the command line:
set(0,'DefaultUITableData',cell(3,1))
im really not sure of what the issue is, I thought that matlab would make it easy to get a 3x1 table especialy in guide. I tried typing the command in the commandline and changing my GUI in the figure window and the table still wont be a 3x1 table
I just made a quick GUI using GUIDE and the CreateFcn worked. Are you setting the table data anywhere else in the code?
The thing about GUIDE is that it sets it will set its own defaults and does not necessarily obey the root's defaults.
Try this:
  1. Create a new blank GUI.
  2. Add a table to it
  3. Save it as something
  4. Add the following line to the first line of the GUI's OutputFcn
set(handles.uitable1,'Data',cell(3,1))
Does this not work for you?
yes, it works. I dont know why its not working on the GUI i already created. I guess i just have to work on it.
Thank you
If you want default contents, instead of setting an empty cell, set it to some default values.

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

추가 답변 (2개)

Iain
Iain 2013년 6월 25일
In your workspace, generate the default contents for the table. Set the data on the table to that.

댓글 수: 3

If you want the table to remain empty for the time being, set the data as
cell(3,1)
Lain,
can you give me directions on how to go to the workspace and generate the default contents of the table?
ok Cordeiie,
At your matlab command line type something like:
default = {5 '4' 3};

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

You can also set the width of the column you wanna remove to 0.

카테고리

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

질문:

2013년 6월 25일

답변:

2021년 11월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by