You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
problem with columnWidth..how solve it
5 views (last 30 days)
Show older comments
size(T)
ans =
73 9
T =
73×9 table
T.ColumnWidth={50,30,30,30,30,30,30,30,30}
Error using .
To assign to or create a variable in a table, the number of rows must match the height of the table.
12 Comments
Dyuman Joshi
on 22 Oct 2023
Moved: Dyuman Joshi
on 22 Oct 2023
The size of the data to be added to the table must be compatible with the dimensions of the table, which is what the error message (explicitly) states as well.
Use -
T.ColumnWidth = [50;30;30;30;30;30;30;30;30];
aldo
on 22 Oct 2023
Moved: Dyuman Joshi
on 22 Oct 2023
Error using .
To assign to or create a variable in a table, the number of rows must match the height of the table.
Error in CaricaListaStrategie_Struct (line 60)
T.ColumnWidth=[50,30,30,30,30,30,30,30,30];
aldo
on 22 Oct 2023
Moved: Dyuman Joshi
on 22 Oct 2023
Error using .
To assign to or create a variable in a table, the number of rows must match the height of the table.
Error in CaricaListaStrategie_Struct (line 60)
T.ColumnWidth=[50;30;30;30;30;30;30;30;30];
Dyuman Joshi
on 22 Oct 2023
Moved: Dyuman Joshi
on 22 Oct 2023
Can you attach the variable T?
aldo
on 22 Oct 2023
Moved: Dyuman Joshi
on 22 Oct 2023
here is the file
Dyuman Joshi
on 22 Oct 2023
Edited: Dyuman Joshi
on 22 Oct 2023
I somehow mixed up the dimensions, Sorry.
The table has 73 rows, thus the data for ColumnWidth should have 73 rows as well.
Do you want to add the data related to a variable present in the column? Or is there a criteria/logic for adding that data?
Voss
on 22 Oct 2023
Moved: Voss
on 22 Oct 2023
If you have a uitable (UIT) whose data is a table variable (T)
UIT = uitable(); % create a uitable (graphics object)
UIT.Data = T; % set the uitable's Data to be the table variable T
Then you can set the ColumnWidth of the uitable like this:
UIT.ColumnWidth = {50,30,30,30,30,30,30,30,30}; % UIT has 9 columns
However, using the same syntax on the table variable T tries to add a variable/column called "ColumnWidth" to the table T, which produces an error in this case because the number of values given doesn't match the number of rows of T.
T.ColumnWidth = {50,30,30,30,30,30,30,30,30} % T has 73 rows, so this doesn't work
Dyuman Joshi
on 22 Oct 2023
And what does width mean here?
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)