Dynamic Drop Down Menu
Show older comments
Hi guys,
i have some data which i have read in to a table (using App Designer). It is possible to read in multiple files. The Data contains some general information in the header and then some force measurement signal. The signal is filtered and the maximum is shown in the table. So now i want to add a drop down menu to plot the graphs from the data. My Problem is that the number of graphs i want to plot depends on the number of files i've read in, so the number is changing. Im not sure how to solve this, so thanks for any help!
The Code i have to store the data in a table is:
function EinlesenButtonPushed(app, event)
%Diese Funktion dient dem direkten Lesen der auf dem übergeben Pfad
%hinterlegten CSV-Datei. Diese Datei muss exakt der Formatierung der
%Dateien entsprechen die das Program "Power" des Diagnostikgerätes
%liefert.
%Einlesen der Datei über den Umweg mit strings
% Öffnen eines Fensters zur Auswahl der zu öffnenden .csv Dateien.
[filename,pathname] = uigetfile('*.csv;','MultiSelect',"on");
for i = 1:length(filename)
filepath=fullfile(pathname, filename);
fid = fopen (filepath{i});
%[file,path]=uigetfile('*.csv');
A = textscan(fid, '%s%s%s%s%s%s%s%s%s%s%s%s%s','Delimiter',';');
%Umwandeln von Cell --> String
B=string([A{:}]);
%',' durch '.' ersetzen
B=replace(B,',', '.'); % ',' durch '.' ersetzen
% Aufteilen in Header und Messdaten
Daten(i).Header=B(1:30,:);
Daten(i).Messdaten=str2double(B(31:end,7));
end
for i = 1:length(filename)
%Uhrzeit / time
u= char(Daten(i).Header(12,1));
u1 = extractBetween(u,13,20 );
%Datum / date
d = char(Daten(i).Header(11,1));
d1 = extractBetween(d,11,20);
%Bein Seite / leg
be = char(Daten(i).Header(21,1));
if strlength(be) == 22
be1 = extractBetween(be,10,14);
else
be1 = extractBetween(be,10,15);
end
% Bewegung /
b = char(Daten(i).Header(23,1));
if strlength(b) == 32
b1 = extractBetween(b,13,21);
else
b1 = extractBetween(b,13,19);
end
% Kraft Tiefpass Filter / lowpass filter
x = Daten(i).Messdaten;
windowsize = 5;
c = (1/windowsize)*ones(1,windowsize);
a = 1;
y = filter(c,a,x);
M =max(y);
drop(i) = append(u1,' ',b1,' ',be1);
% Einlesen der Daten in Tabelle
data(i,:) = [d1 u1 b1 be1 M drop(i)];
end
app.UITable.Data = data;
end
Accepted Answer
More Answers (0)
Categories
Find more on Get Started with MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!