MATLAB Answers


Merge 2 fields in a structure

Asked by Tyler Murray on 6 Sep 2016
Latest activity Commented on by Walter Roberson
on 7 Sep 2016
After I use importdata MATLAB splits up my data for some reason. The result is 2 fields within one structure, is a 6000x9 double and A.textdata is a 6000x16 cell. The goal is to have one matrix 6000 x 25. Since they have the same number of rows I figured I could combine them using
A1 = [, A.textdata];
however I get the error "Error using cat Dimension must be a real positive finite integer." I am unsure if it is because some of the cells contain strings.
A1 = {{:}; A.textdata{:}};
did not work either.


Sign in to comment.

1 Answer

Answer by Walter Roberson
on 7 Sep 2016

[num2cell(, A.textdata]


That does work. However when the new array appears, a 6000 x 25 cell, and I click on the variable to see the data only the first 16 columns show up. Any idea why?

Sign in to comment.