LTPDA Toolbox, creating multiple timelines automatically

조회 수: 3 (최근 30일)
Leo Pape
Leo Pape 2016년 12월 21일
편집: Leo Pape 2016년 12월 21일
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.

답변 (1개)

Leo Pape
Leo Pape 2016년 12월 21일
편집: Leo Pape 2016년 12월 21일
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;

카테고리

Help CenterFile Exchange에서 Time Series Events에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by