How can I merge multiple cells of data into one cell?

24 ビュー (過去 30 日間)
Linus Dock
Linus Dock 2016 年 10 月 7 日
編集済み: PARISA SATTAR 2022 年 5 月 24 日
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
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 件)

Massimo Zanetti
Massimo Zanetti 2016 年 10 月 7 日
  1 件のコメント
Linus Dock
Linus Dock 2016 年 10 月 7 日
Ok thanks for the information! But I need to obtain one cell with the data from my many cells (actually around 100). The data I have looks like this:
Utdata =
{1255x1 cell}
{1487x1 cell}
{1447x1 cell}
{1464x1 cell}
{1433x1 cell}
{1500x1 cell}
...and so on
and I would like the output like this
Utdata =
{manyrowsx1 cell}
How can this be done in a simple manner? After this step I would like to save my Utdata into a .xlxs file for easy overview, but that is pretty straightforward.

サインインしてコメントする。


Peng
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}

PARISA SATTAR
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

カテゴリ

Help Center および File ExchangeWhos についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by