Any approach faster to concatenate multi dimension cell?

1 回表示 (過去 30 日間)
balandong
balandong 2017 年 10 月 13 日
コメント済み: Cedric 2017 年 10 月 16 日
Dear all,
The objective was to concatenate multi dimension cell, may I know how to avoid such a FOR loop.
Thanks in advance
load('completedata.mat')
c_x=1;
for f_x=1:4
myData(c_x,:)= data_lap_th{f_x}.e_subj;
c_x=c_x+1;
end

採用された回答

per isakson
per isakson 2017 年 10 月 13 日
編集済み: per isakson 2017 年 10 月 13 日
Try
>> S = load('completedata.mat');
>> S.data_lap_th
ans =
[1x1 struct] [1x1 struct] [1x1 struct] [1x1 struct]
>>
>> sas = [S.data_lap_th{:}];
>> sas
sas =
1x4 struct array with fields:
e_subj
Whether it faster I don't know, but it is Matlabish.
  4 件のコメント
balandong
balandong 2017 年 10 月 16 日
Hi Cedric, Thanks for valuable response, really appreciate it.
Cedric
Cedric 2017 年 10 月 16 日
My pleasure!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by