How can I merge multiple cells of data into one cell?
7 次查看(过去 30 天)
显示 更早的评论
Hi, I have a cell containing several cells of output data on the form:
'METAR ESDF 200807010020Z AUTO 31003KT 230V350 9999NDV NCD 12/08 Q1017'
The outer cell looks like this:
<1x6cell>
and the inner ones like this:
<1250x1cell> <1500x1celll> ...and so on
I would like to merge these inner cells to have all my data inside one cell. Is there an easy solution to this problem?
Thank you!
1 个评论
Reshad Ahmad Aria Faizy
2021-1-21
编辑:Reshad Ahmad Aria Faizy
2021-1-21
% A is your cell which contains many cell
% B , where you want to put them all
k=0;
for i=1:size(A,1)
j = size (A{i,1},1);
B (k+1:j+k,:) = A{i,1};
k = size(B,1);
end
ref:@Ali Pourzangbar
回答(3 个)
Peng
2018-12-1
% transfer a nested cell array to a cell array
SEGS = {{rand(2,1);rand(3,1)};...
{rand(4,1);rand(5,1);rand(6,1)};...
{rand(7,1);rand(8,1);rand(9,1);rand(10,1)}};
A = SEGS{1};
for k = 2:size(SEGS,1)
A = [A;SEGS{k}];
end
SEGS =
{2x1 cell}
{3x1 cell}
{4x1 cell}
A =
{9x1 cell}
0 个评论
PARISA SATTAR
2022-5-24
编辑:PARISA SATTAR
2022-5-24
Data1=struct2array(load(input('enter the name of first cell:\n','s')));
Data2=struct2array(load(input('enter the name of 2nd cell:\n','s')));
l1=length(Data1);
l2=length(Data2);
l=l1+l2;
j=1
for i=1:l;
if i<=l1
R_peak_Locations_N2_CG_RBDid{i,1}=Data1{i,1}
else
R_peak_Locations_N2_CG_RBDid{i,1}=Data2{j,1}
j=j+1;
end
end
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!