Printing to screen command window.
显示 更早的评论
Hi,
I am building a pseudo DB using a cell array. Each column will contain numerical array of varying sizes all calculated from the corresponding cells in previous column. So as you move across the cell array you can descend through the calculations.
The exception to this is the first row of the cell array, ca{1,:}. Each of these cells in turn contains a cell array containing the headings for the columns in the numerical arrays.
ca{1,2} = 'A' 'B' 'C'....
ca{2,2} = (dataA, dataB, datac) where data is numerical
I am trying to write a little function for the command window that will take this txt and return it, a bit like help file but for data definition. What I am after to return;
>>askDB(ca)
ans =
layer 1
a
b
c...
layer 2
A
B
C...
So far I have this code, it takes the top row of cells and changes the contain cells from row to column format. But I am tying my self in knots trying to work out how to achieve my output with the various ways to print or send output.
function arCout = arCont(arCin)
% List the contents of cell array.
% Will take the first row and extract the headings from the cells.
% % INPUT
% Cell Array{n,n}(,);
% CN{1,n} char array, data headings and description
[xL, yL] = size(arCin);
arnew = arCin(1,1:yL);
for ii = 1:yL
[xLx, yLy] = size(arnew{1,ii});
arnew{1,ii} = arnew{1,ii}(1,:);
arnew{1,ii} = reshape(arnew{1,ii}(), yLy, []);
end
arCout = arnew;
Can you help in returning my cell contents is a logical concise format.
Regards,
AD
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Cell Arrays 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!