How to stop loop rewriting

I have this loop but it only shows results for the final iteration. I have 10 files and want to see results for all 10 files. Any ideas?
notebook = readtable('notebook.xlsx');
filename = notebook.Filename;
num_files = length(filename);
exp = cell(1,num_files);
set(0,'DefaultFigureWindowStyle','docked')
for n = 1:num_files
fname = filename{n};
exp{n} = import_wcp(fname);
num_samp = size(exp{n}.S{1},1);
t = 0:exp{n}.t_interval:(num_samp-1)*exp{n}.t_interval;
B = exp{n}.S{1,1}(1:400,:);
B(B>-0.1) = [0];
B(B<-0.6) = [0];
end

1 件のコメント

DGM
DGM 2022 年 4 月 17 日
Edited to restore deleted question.

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

回答 (1 件)

KSSV
KSSV 2022 年 4 月 15 日
編集済み: KSSV 2022 年 4 月 15 日

0 投票

notebook = readtable('notebook.xlsx');
filename = notebook.Filename;
num_files = length(filename);
exp = cell(1,num_files);
set(0,'DefaultFigureWindowStyle','docked')
T = cell(num_files,1) ;
BB = cell(num_files,1) ;
for n = 1:num_files
fname = filename{n};
exp{n} = import_wcp(fname);
num_samp = size(exp{n}.S{1},1);
t = 0:exp{n}.t_interval:(num_samp-1)*exp{n}.t_interval;
B = exp{n}.S{1,1}(1:400,:);
B(B>-0.1) = [0];
B(B<-0.6) = [0];
% Save each file t, B
T{n} = t ;
BB{n} = B ;
end
celldisp(T)
celldisp(BB)
If the data size in each cell is same, you can save them into a matrix by initializing matrix instead of cell array or convert the cell array into matrix using Cell2mat.

カテゴリ

ヘルプ センター および File ExchangeFunctions についてさらに検索

製品

タグ

質問済み:

2022 年 4 月 15 日

コメント済み:

DGM
2022 年 4 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by