How to put matrix into a table (App designer)
9 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Arthi Sathyamurthi
2021-7-29
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!