LTPDA Toolbox, creating multiple timelines automatically

3 visualizzazioni (ultimi 30 giorni)
I want to create timeline with the LTPDA toolbox. I want to Create one ao but with a variable number of datasets. Until now I used something like this:
if true
cd(pathname);
ltpda_startup
%%reading filenames in
liste = dir('*TXT*') ; %Alle Dateiinfos
files = {liste.name};
data = cell(3,numel(files));
%%reading data in
for k=1:numel(files)
p = dlmread(fullfile(pathname,files{k}),' ',0,3); %spezifizieren welche Zeile und Spalte eingelesen werden soll
data{1,k} = files(1,k); %name
data{2,k} = p(:,1); %time
data{3,k} = p(:,2); %y-value
end
clear p;
%%creating ltpda objects
timeline = [ao(data{2,1},data{3,1},plist('type','tsdata','yunits','V','name',files(1,1))),...
ao(data{2,2},data{3,2},plist('type','tsdata','yunits','V','name',files(1,2)))];
end
in %%creating ltpda objects I would like to have an automatic way depending on the number of files I'm reading in e.g. if I have 3 files, At the moment I would have to add an additional line
if true
% code
timeline = [ao(data{2,1},data{3,1},plist('type','tsdata','yunits','V','name',files(1,1))),...
ao(data{2,2},data{3,2},plist('type','tsdata','yunits','V','name',files(1,2))),...
ao(data{2,3},data{3,3},plist('type','tsdata','yunits','V','name',files(1,3)))];
end
But this is rather unsatisfying.

Risposte (1)

Leo Pape
Leo Pape il 21 Dic 2016
Modificato: Leo Pape il 21 Dic 2016
found a solution
if true
% code
end
%%creating ltpda objects
timeline=ao.zeros(1,numel(files));
for k=1:numel(files)
t = ao(data{2,k},data{3,k},plist('type','tsdata','yunits','V','name',files(1,k)));
timeline(1,k)=t;
end
clear k;
clear t;

Categorie

Scopri di più su Time Series Events in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by