How to put matrix into a table (App designer)
9 views (last 30 days)
Show older comments
Hello. I have a program that produces velocity vs time. The loop calculates the values of Vx and Vz. I tried to make this data into a table like shown in the picture but it didn't work. I only manged to put the time column but when i try to write: app.UITable.Data = [B vx(i)]. It says dimensions of arrays being concatenated are not consistant.
thanks
0 Comments
Answers (1)
Arthi Sathyamurthi
on 29 Jul 2021
Hello Mena,
The error “dimensions of arrays being concatenated are not consistent” is encountered when you try to concatenate arrays that do not have compatible sizes. From the image shared, I assume the variable ‘B’ is of size 10*1 and the variable ‘vx’ is of size 1*10. And, when you concatenate as [B vx(i)] the size of the the variable vx(i) is 1*1. Hence a size mismatch happens.
To solve this issue, after the ‘for’ loop you can create a multicolumn table and add the table values in the UI table. This can be done using the snippet below
fig = uifigure;
tdata = table(B',vx,'VariableNames',{'Time','VX'});
uit = uitable(fig,'Data',tdata);
Or else after the ‘for’ loop you can concatenate arrays as [B’ vx] or [t vx] and assign it to the ‘Data’ of UITable. This can be done using the snippet below
app.UITable.Data = [B' vx];
You can look at the following MathWorks documentation link to know how to design a table in App Designer
0 Comments
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!