How to turn existing code into app and which components to use?

10 vues (au cours des 30 derniers jours)
Julia Williams
Julia Williams le 3 Déc 2019
Commenté : Walter Roberson le 4 Déc 2019
Hello! I would like to create an app that would promt a user to select a file from thier computer and then run code that I have already created. I know I need to use app designer but I do not understand which component to select to prompt the user to select and file and then on the back end how to apply my function. Any help is appreciated!
  2 commentaires
Walter Roberson
Walter Roberson le 3 Déc 2019
uigetfile() can be used in App Designer.
Julia Williams
Julia Williams le 4 Déc 2019
Hi Walter! Thank you for your help!

Connectez-vous pour commenter.

Réponse acceptée

Bhaskar R
Bhaskar R le 3 Déc 2019
You can use any action UI control button in app designer, suppose mostly used one is push button. In the respective UI control call back write your code as
[flname, pt] = uigetfile('*.m', 'Select the m file');
run([pt, flname])
For more info/ help on MATLAB app designer read
  2 commentaires
Julia Williams
Julia Williams le 4 Déc 2019
Hi Bhaskar! I ended up using this! Thank you so much!
Walter Roberson
Walter Roberson le 4 Déc 2019
Note: it would be better to use
run(fullfile(pt, flname))
uigetfile does not promise that the path will end in a directory separator.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by