How can I invoke a Java window from an mdl file?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Kaustubha Govind
el 25 de Jul. de 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 comentarios
Ver también
Categorías
Más información sobre Call Java from MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!