Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Stacking many vector data into one resultant vector data but of the same length

1 回表示 (過去 30 日間)
Arthur Batte
Arthur Batte 2020 年 7 月 11 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hi is there anyone who could direct me on how i could stack my data without increasing the length of the output. i have tried to use the stack function but apparently, the length of the resultant is larger than the input. i have attached a file of 10 columns and each column has a length of 15493 records. i would wish to stack all the 10 into 1 with a length of 15493. Is there something that can be done?
thanks
  1 件のコメント
madhan ravi
madhan ravi 2020 年 7 月 11 日
Store each record as a cell.

回答 (1 件)

madhan ravi
madhan ravi 2020 年 7 月 11 日
編集済み: madhan ravi 2020 年 7 月 11 日
nrecords = 10;
Data = cell(nrecords, 1);
for k = 1:nrecords
Data{k} = dlmread(sprintf('data%d.txt',k));
end
celldisp(Data)
DATA = cat(3, Data{:}) % as 3D
  1 件のコメント
Arthur Batte
Arthur Batte 2020 年 7 月 11 日
thanks madhan, but i think u misunderstood me, what i wanted is to stack all the ten records into one record but of the same length.

この質問は閉じられています。

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by