![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1078990/image.jpeg)
Stateflow passing strings as input to graphical functions
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
David Philipp Klüner
el 4 de Mayo de 2019
Respondida: Muthukumar Ganesan
el 27 de Jul. de 2022
Hello,
I want to use Matlab Stateflow to control a large software system and I am using c to interact with this system. Now I wanted to wrap my c functions with graphical functions, which would perfom some additional checks based on information from the Stateflow Chart. To do this, I would need to pass strings to those graphical functions. Unfortunately this is where I got stuck: Every time I try to pass a string to a function, I get the error: "String literal "..." is not allowed in this context." and the simulation fails. I have to admit that my experience with Stateflow is still quite small, so I don't really understand why a string literal would not be allowed there. Some more Information about my case:
- The Datatype of the Input Variable is set to string and the scope is Input.
- The Action Language is C.
- There appear to be no other errors in the small test chart I am using (so without the function or just the argument, everything runs just fine).
- I use Matlab Version R2019a.
Thank you for your help and please excuse any spelling mistakes, english is not my first language.
0 comentarios
Respuestas (1)
Muthukumar Ganesan
el 27 de Jul. de 2022
Hi,
Yes, Stateflow doesn't support to pass a string literal directly whereas you can use a local string variable to store the string literal and pass the variable to graphical function.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1078990/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1078990/image.jpeg)
Hope this helps. Thanks.
0 comentarios
Ver también
Categorías
Más información sobre Stateflow 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!