How to use data from App designer App drop downs and fields to populate variables in a script?

3 visualizaciones (últimos 30 días)
I have a script that there are some variables that need to be set manualy before hand that contols time and angle etc. When the script is run it askes you to select a file to load that it will proccess and spit out another set of files. I would like to be able to have a front end gui that can be compiled stand alone to run on a laptop without Matlab. This app will have a button to load the file, fields and drop downs to populate the variables in the script.
I have the basic app layout done. The Load button works and the app returns to the top of the stack of windows on the screen. I have created parameters in App Designer for all the variables in the script that need populated. I am unsure how to pass the data from the App to the script. Or do I somehow move the script to the App. Untill all variables are populated in the script the script cannot be ran correclty.
thanks for any advice

Respuesta aceptada

Image Analyst
Image Analyst el 23 de Mayo de 2022
You can't pass variables to a script directly. You can write a .mat file and have your script open it. But it's better to turn your script into a function. The function can be a separate m-file, or put into your app's .mlapp file.
  10 comentarios
Donny Mott
Donny Mott el 24 de Mayo de 2022
Yes it opens in app designer. Behind teh load folder buton was references to Guid. So I thought it may have been made in Guide.
% Button pushed function: btnSelectFolder
function btnSelectFolder_Callback(app, event)
% Create GUIDE-style callback args - Added by Migration Tool
[hObject, eventdata, handles] = convertToGUIDECallbackArguments(app, event); %#ok<ASGLU>
Image Analyst
Image Analyst el 24 de Mayo de 2022
Oh, it just added those because the original code was in GUIDE and it migrated it. I guess it just wnated to document that fact.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by