How can I invoke a Java window from an mdl file?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Kaustubha Govind
le 25 Juil 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 commentaires
Voir également
Catégories
En savoir plus sur Call Java from MATLAB dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!