How can I invoke a Java window from an mdl file?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I've created a block that looks like this in my mdl file:
Block {
BlockType "S-Function"
Name "FileReader"
...
MaskPromptString "File Name|Output Port Type|Hex|Round|Comment"
MaskStyleString "edit,popup(int|uint|dint|duint|fixed point|"
"dfixed point),checkbox,checkbox,edit"
...
Rather than enter a file name in an editable text field, I want to invoke a Java JFileChooser. Is this possible?
0 Kommentare
Antworten (1)
Kaustubha Govind
am 25 Jul. 2012
I would recommend first writing a MATLAB function to call into your Java function and get the selected file name. See Using Java Libraries from MATLAB for documentation regarding this. Once you have tested this, call this from your model's PostLoadFcn or InitFcn callbacks, so that the MATLAB function is called everytime the model is loaded or run. In your MATLAB function, you can also use set_param to set the S-function name to that returned from the Java function. Note that you may need to add the selected folder to the MATLAB path if it isn't already there.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Call Java from MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!