Multiple datasets to single table

4 ビュー (過去 30 日間)
Joost de Witte
Joost de Witte 2019 年 12 月 4 日
回答済み: Jakob B. Nielsen 2019 年 12 月 4 日
Hello all,
I've got a large number of datasets.mat. I've writen a script that calculates averages of a single dataset which results in one single value for the loaded data set. The datasets are identical and when I change the loaded file name from data1 to data2 for example it still works as desired.
I now want to gather all these averages into one table, but have to clue on how to approach this problem (matlab novice). Any help will be appreciated, thanks!

採用された回答

Jakob B. Nielsen
Jakob B. Nielsen 2019 年 12 月 4 日
You can try using something like this.
[Names,Paths]=uigetfile('*.mat','MultiSelect','on');
entirefile =fullfile(Paths,Names); %entirefile is now a cell array containing the path of all your files
average=zeros(numel(entirefile),1); %initialise an array of 0's
for i=1:numel(entirefile) %automatically repeats the sequence a number of times equal to the number of files you picked
tempdata=load(entirefile{i}); %use curly brackets when indexing cells :)
average(i)=callyourfunction(tempdata);
end
Overview=table(Names',average); %Names is a row vector, so add the ' to turn it into a column.
%Now you should have a table showing you the data file name and its corresponding average value.

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by