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

 Accepted Answer

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 Comments

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.?
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.

Sign in to comment.

More Answers (2)

In your workspace, generate the default contents for the table. Set the data on the table to that.

3 Comments

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};

Sign in to comment.

Categories

Community Treasure Hunt

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

Start Hunting!