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

3 visualizaciones (últimos 30 días)
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 comentario
Voss
Voss el 2 de En. de 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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by