フィルターのクリア

I want to use a .mlapp to input user variables into my .m code

24 ビュー (過去 30 日間)
Jarrett Liner
Jarrett Liner 2022 年 1 月 27 日
回答済み: Reshma Nerella 2022 年 2 月 3 日
:noob, take it easy on me.
I wrote a script to control a set of RF test instruments (spectrum analyzer, Signal Generator...)
Mostly just SCPI commands. the script works well.
I want to give this to other stakeholders, but it may be difficult for them to find and enter the user variables (TCIP address, intrument settings...) whithin the script.
The app designer looks like a great way to implement a GUI for this script.
I need help understanding how to merge the script (.m) and the app (.mlapp).
I converted the .mlapp to a .m by "save/Export to .m file"
where do I insert my script?
is that even the right (best) way to get what I want?
how do I get the GUI portion to run (get created), then wait for the user to enter the variables before continuing?
I can imagine an "execute" button on the GUI that would run the script, and the script would grab the variables from the GUI.
change the variables and "execute" again with the new variables.
any help would be greatly appreciated. If I can make this happen, there will be happiness spread across the land.
  3 件のコメント
Jarrett Liner
Jarrett Liner 2022 年 1 月 27 日
yeah, the question is all over the place.
I wrote a matlab script, .m It works well
other users may have a problem changing the variables.
that prompted me to create a GUI in app designer. (.mlapp)
I have an app (.mlapp) with the variable inputs (text and numeric fields).
I want to use those app inputs in my original matlab script (.m)
I researched, and I found that I could convert the .mlapp to a .m script. I did that. ran it as a (.m) script, the GUI was created that looks exactly like the GUI from the app designer .mlapp.
now I have the GUI and the origial script both in matlab as seperate .m scripts. (maybe this is not the way to do it)
I was thinking I could add my original script (.m) to the converted (from .mlapp to .m) GUI script and call the user input variables.
I dont know where to insert the origianl script in to the converted script to be useful. I am sure this is the wrong way to do this. thanks for wanting to help.
Rik
Rik 2022 年 1 月 28 日
Your script should be a function, then you can easily call it (either from inside the mlapp, or the m file).

サインインしてコメントする。

回答 (1 件)

Reshma Nerella
Reshma Nerella 2022 年 2 月 3 日
Hi,
To take input from your app created using app deisgner, you can use uicomponents like edit fields(text or numeric), drop down etc.You can add a button in your app, that user can click once all the inputs are filled. Add a button clicked function(callback for the button). When clicked, retrieve the input values required from the uicomponents. To call your script, you can
  1. Save the uicomponents values in base workspace and then call your.m script.
  2. Convert the script to a function and pass them as input arguments to your function.
Here are the few links for your reference:

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by