Looking backwards,
so out is a 1 x 1 cell array whose first and only element is the array PPM
PPM{i}={out1 out2 out3 out4 out5}
so PPM is a 1 x 3 cell array, and each cell in PPM is to contain a 1 x 5 cell array
out1=num2cell(i);
out2={num2cell(elems(1,1)) num2cell(elems(1,2))};
out3=num2cell(L(i,1));
out4=num2cell(A(i,1));
out5=num2cell(E(i,1));
the first, third, fourth, and fifth of which are to be cell arrays containing scalars, and the second of which is to be a 1 x 2 cell array inside of each of which is a cell array containing a scalar
If I analyze correctly, out is
{{{{scalar} {{scalar} {scalar}} {scalar} {scalar} {scalar}} {{{scalar} {{scalar} {scalar}} {scalar} {scalar} {scalar}} {{{scalar} {{scalar} {scalar}} {scalar} {scalar} {scalar}}}}
This is not something that can be represented in a uitable.
The data property for a uitable can be:
- a numeric array
- a logical array
- a character vector
- a cell array, each entry of which is a numeric scalar, a logical scalar, or a character vector
It is never possible to for the data property to have a cell inside a cell.
You have a particular problem with out2: in uitable, it is not possible for a single column to store multiple values (except in that character vectors are, in one sense, multiple values).
I think you need to go for 6 columns.
It looks to me as if you could construct a simple numeric output.
I notice that your out2 does not subscript with i. In the below I presume that was a mistake, that you want different outputs for the out2
idx = 1 : 3;
PPM = [idx.', elems(idx,1:2), L(idx,1), A(idx,1), E(idx,1)];
set(handles.uitable1,'Data', PPM);
This code replaces all of the looping and all of the {} construction. All of your data appears to be numeric so there is no need to break it up into individual cells. (I cannot actually tell that for sure, though: it is not impossible that some of your data is character vector)
Best Answer