Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Return a structure kind output from a programmatic UI and then use this output to modify a settings parameters m-file

1 visualizzazione (ultimi 30 giorni)
Hi everybody,
I am developing a programmatic UI that returns a structure kind output and then I want the output to be imported to a m-file in order to modify a m-file settings parameters.
function selpar
%SELPAR Summary of this function goes here
% Define struct
data = struct('chanBW', 1, 'modType', 1);
% Construct the components
f = figure('Visible','on','Name','selpar','Position',[360,200,450,285]);
%guidata(f,struct('chanBW',1.4,'modType',1));
pmchanBw = uicontrol(f,'Style','popupmenu', 'Callback', @select_chanBW,'String',{'1.4','3','5','10','15','20'},...
'Position',[30 80 130 20],'Tag','popumpmenu1');
pmod = uicontrol(f,'Style', 'popupmenu', 'Callback', @select_modulation, 'String', {'QPSK', '16QAM', '64QAM'},...
'Position',[30 120 130 20],'Tag','popupmenu2');
push = uicontrol(f, 'Style', 'pushbutton', 'Callback', @start_simulation, 'String', {'Start'},...
'Position',[250 60 40 20]);
%Write Callbacks
function select_chanBW(hObject, callbackdata)
chanString = hObject.String;
chanValue = hObject.Value;
switch chanString{chanValue}
case '1.4'
data.chanBW = 1;
case '3'
data.chanBW = 2;
case '5'
data.chanBW = 3;
case '10'
data.chanBW = 4;
case '15'
data.chanBW = 5;
case '20'
data.chanBW = 6;
end
end
function select_modulation(hObject, callbackdata)
modString = hObject.String;
modValue = hObject.Value;
switch modString{modValue}
case 'QPSK'
data.modType = 1;
case '16QAM'
data.modType = 2;
case '64QAM'
data.modType = 3;
end
end
function start_simulation(hObject, callbackdata)
display([data.chanBW data.modType]);
%Here has to be placed the code referred to export the structure data
%Call the main code (which reads the settings parameters m-file)
end
end
Thanks in advance.

Risposte (0)

Questa domanda è chiusa.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by