How to index a specific column in a Cell

7 ビュー (過去 30 日間)
Lutz
Lutz 2023 年 1 月 8 日
コメント済み: Lutz 2023 年 1 月 9 日
Hey guys,
I have a cell wich contains different parts of a audiosignal. In every part of the cell is a column with the timestamps and a data column.
I want to write .wav files out of them and only need the data column. I tried alot of things but at this point im super confused and think that i can`t see the forest because of the trees anymore.
Thats how i created the cell:
data_store{ci} = [xx(:) yy(:)]; % 2 columns : time / data
thats my loop to write it, but with the time column:
folder = 'C:\XXX\Soundanalyse\Spectro_Analysis\Tones\Single_Tones\'
for i = 1:length(struct)
file = fullfile(folder, sprintf('JD(%d).wav', i));
audiowrite(file, struct(i).tones, Fs);
end
I thought also about putting it with cell2mat into variables to go from there but for me it looks a bit weird to have the extra step inside...
Thats how the cell looks from the inside:
Thanks guys!

採用された回答

dpb
dpb 2023 年 1 月 8 日
Dereference the cell, then index into the resulting array...
c=[{[[0:3].' rand(4,1)]} {[10+[0:3].' rand(4,1)]}]
c = 1×2 cell array
{4×2 double} {4×2 double}
c{2}(:,1) % time of second cell
ans = 4×1
10 11 12 13
c{2}(:,2) % and the data
ans = 4×1
0.1808 0.5277 0.1604 0.0784
  1 件のコメント
Lutz
Lutz 2023 年 1 月 9 日
Thanks for showing me the obvious, I really appreciate it :D !!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAudio I/O and Waveform Generation についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by