'summary' function for a cell

3 次查看(过去 30 天)
summary function provides a summary of a content of a table
Then what is a function to summarize the information of a cell?

采纳的回答

madhan ravi
madhan ravi 2020-12-19
help cell2table
CELL2TABLE Convert cell array to table. T = CELL2TABLE(C) converts the M-by-N cell array C to an M-by-N table T. CELL2TABLE vertically concatenates the contents of the cells in each column of C to create each variable in T, with one exception: if a column of C contains character vectors, then the corresponding variable in T is a cell array of character vectors. T = CELL2TABLE(C, 'PARAM1', VAL1, 'PARAM2', VAL2, ...) specifies optional parameter name/value pairs that determine how the data in C are converted. 'VariableNames' A string array or cell array of character vectors containing variable names for T. The names must be valid MATLAB identifiers, and must be unique. 'RowNames' A string array or cell array of character vectors containing row names for T. The names need not be valid MATLAB identifiers, but must be unique. See also TABLE2CELL, ARRAY2TABLE, STRUCT2TABLE, TABLE. Documentation for cell2table doc cell2table
  7 个评论
Farshid R
Farshid R 2020-12-22
Hi
Good time
I wrote this code but it gives an error
Please help me
thank you
n=100;
u1=[0,0]';
X1=[-4,-2,0]';
% p=data.PredictionHorizon;
a=0.9;h=0.9;
cp1=1;cp2=1;cp3=1;
% c1=0;c2=0;c3=0;
for j=1:n
c1(j)=(1-(1+a)/j)*cp1;
c2(j)=(1-(1+a)/j)*cp2;
c3(j)=(1-(1+a)/j)*cp3;
cp1=c1(j); cp2=c2(j); cp3=c3(j);
end
% initial conditions setting:
v1(1)=u1(1);
w1(1)=u1(2);
x1(1)=X1(1); y1(1)=X1(2); z1(1)=X1(3);
% calculation of phase portraits /numerical solution/:
for i=2:n
x1(i)=h*cos(z1(i-1))*v1(i-1) - memo(x1, c1, i);
y1(i)=h*sin(z1(i-1))*v1(i-1)-memo(y1, c2, i);
z1(i)=h*w1(i-1)-memo(z1, c3, i) ;
end
%%
function [yo] = memo(r, c, k)
%
temp = 0;
for j=1:k-1
temp = temp + c(j)*r(k-j);
end
yo = temp;
%
%%%%% error
Index exceeds the number of array elements (1).
Error in exocstrstateFcnCT1 (line 28)
x1(i)=h*cos(z1(i-1))*v1(i-1) - memo(x1, c1, i);
Walter Roberson
Walter Roberson 2020-12-23
You only initialize v1(1) so you have a problem when i = 3 because then you need v1(3-1) -> v1(2)

请先登录,再进行评论。

更多回答(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