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 件のコメント

Cordelle
Cordelle 2013 年 6 月 25 日
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))
?
Cordelle
Cordelle 2013 年 6 月 25 日
the program ran without any errors; however, I still dont have a 3,1 table.
Tom
Tom 2013 年 6 月 25 日
@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.?
Cordelle
Cordelle 2013 年 6 月 25 日
same result, still not able to get a 3x1 table
Try running this in the command line:
set(0,'DefaultUITableData',cell(3,1))
Cordelle
Cordelle 2013 年 6 月 25 日
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
Tom
Tom 2013 年 6 月 25 日
編集済み: Tom 2013 年 6 月 25 日
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?
Cordelle
Cordelle 2013 年 6 月 25 日
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
Sean de Wolski
Sean de Wolski 2013 年 6 月 25 日
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)
Cordelle
Cordelle 2013 年 6 月 25 日
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};

サインインしてコメントする。

Neman Abdoli
Neman Abdoli 2021 年 11 月 10 日
You can also set the width of the column you wanna remove to 0.

カテゴリ

ヘルプ センター および File ExchangeTables についてさらに検索

質問済み:

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