필터 지우기
필터 지우기

How do I add an array to a table?

조회 수: 113 (최근 30일)
Mariana
Mariana 2019년 12월 15일
댓글: Adam Danz 2019년 12월 16일
I already tried the matlab function arratotable. The error that I have is that the array is not of the same dimension of the table. How can I fix this problem ?

채택된 답변

Adam Danz
Adam Danz 2019년 12월 15일
편집: Adam Danz 2019년 12월 16일
If you're adding a new column of data to an existing table, the column must have an equal number of elements as all other columns of data in the table. One way of achieving that is by padding the shorter column(s) with NaN values (or some other default value).
Often times it's easiest just to pad values to the end of a column using [x; NaN(sz)] but there are functions that may come in handy such as B = padarray(A,padsize,padval).
If you have any problems implementing this method, show us your code and we can help straighten it out.
  댓글 수: 5
Image Analyst
Image Analyst 2019년 12월 16일
What is the size of the array? And of the table you expect to get?
Do you want to split up the array so that each column or row goes into one column of the table? Like you have an N-by-3 matrix and want each column of that to go into individual columns of the table.
OR do you want to have each element of the table contain the complete array, for example row 1, column 2 (or whatever) contains a 3-row-by-5 column matrix, and all other rows in that column 2 would also contain other 3x5 matrices as well? (Similar to what the example in the help shows for blood pressure.)
Adam Danz
Adam Danz 2019년 12월 16일
"Do you know how to make the sum of a value from a table and another in a cell array?"
This isn't clear to me. Could you give an example?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by