File selection using uigetfile in an App in appdesigner

13 Ansichten (letzte 30 Tage)
Ranjan Sonalkar
Ranjan Sonalkar am 9 Dez. 2021
Beantwortet: Yongjian Feng am 28 Jan. 2022
I want to select a file using uigetfile and then display the name in a Edit Field (text) window, What is the best way to do this in Appdesigner?
I have done a similar function in an app that I had designed in Guide. There, I could call uigetfile as soon as I clicked in the Edit Field (text) window using the Callback function, in which I called the uigetfile function.
In appdesigner I see only ValueChanged and ValueChanging function for the Edit Field (text) Component, neither of which seems to tbe the right Callback to use.
  1 Kommentar
Michael Van de Graaff
Michael Van de Graaff am 9 Dez. 2021
Can you replace the edit field with a button? Then you can use a ButtonPusedCallback or whatever.
But you could do ValueChanged function, then put uigetfile in there, so when you edit (and i think you have to click away or press enter to satify conditions for ValueChanged) the text the same thing happens.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Yongjian Feng
Yongjian Feng am 28 Jan. 2022
uigetfile in general is put in a callback for a button, as mentioned by Michael. The ValueChanged callback of a textbox is not a good choice becaue:
  1. You need to change the value being shown in the textbox first
  2. You need to then click away or press Enter
Your callback is called only after both above happened.
Why do you want to link a uigetfile to a textbox?

Kategorien

Mehr zu App Building finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by