Azzera filtri
Azzera filtri

Creating a Plotting GUI to extra data from nested structure file and plot

3 visualizzazioni (ultimi 30 giorni)
I have obtained data from a instrument that is in the form of a strucutre file.
The format of the file is similar to the file created using this code:
clc;clear
% Create a sample nested structure
nestedStruct.dev1260.deviceName = 'MyDevice';
nestedStruct.dev1260.deviceID = 1260;
% Adding demodulators as an array of structures
numDemods = 1;
for i = 1:numDemods
% nestedStruct.dev1260.demods(i).demodulatorName = ['Demodulator' num2str(i)];
nestedStruct.dev1260.demods(i).frequency = rand(1,10); % Some frequency value (this is my x-axis)
nestedStruct.dev1260.demods(i).amplitude = rand(1, 10); % Some amplitude values (this is my y-axis)
nestedStruct.dev1260.demods(i).someothergarbage = rand(1,10); % Not really important
end
% Save the nested structure to a .mat file
save('nestedStructureFile.mat', 'nestedStruct');
My goal is to create a GUI that will be able to do the following:
  1. search for the data file
  2. allow the user to click through to which data I want to plot on my x and y axes
  3. plot the data
The plot would look like:
plot(nestedStruct.dev1260.demods.frequency,nestedStruct.dev1260.demods.amplitude)
I have a GUI that is able to do the first step (browse the file in the current directory, which is sufficient), but I am having trouble clicking through the nested strcuture and selecting the data that I need to plotted in my x- and y- axes.
I attached the GUI code.
Any pointers are appreciated.
  1 Commento
Voss
Voss il 2 Gen 2024
How do you envision step 2 would work? That is, what exactly would the GUI do as the user "clicks through" the nested structure? You may consider using a uitree instead of a listbox.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by