# How to put matrix into a table (App designer)

조회 수: 17(최근 30일)
Mena Abdaullah 2021년 5월 11일
답변: Arthi Sathyamurthi 2021년 7월 29일
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

댓글을 달려면 로그인하십시오.

### 답변(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

댓글을 달려면 로그인하십시오.

### Community Treasure Hunt

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

Start Hunting!

Translated by