Simulink string input implementation
Show older comments
hello team,
When i am using string in the if loop in simulink i am having issue.

Edit :
For every TR case, i want output A = "National" or "State" instead of A = 11.
But it is not showing error when A = 11 replaced by A = "National".
How to resolve it.

In case if possible, what data type to be used in Model explorer for this input ?
Thank you
P.S : i am new to simulink.
9 Comments
Walter Roberson
on 25 Dec 2020
Either reconfigure state variable A to be numeric or else assign in string values such as A = "11"
Watch out for the possibility that TR is not any of those values.
Note: you are using Simscape, which has some noticable differences from most of Simulink.
NIKHIL
on 28 Dec 2020
Walter Roberson
on 28 Dec 2020
If it is not showing an error when you assign a quoted value to A, then what is there to fix? Just assign the desired strings.
NIKHIL
on 28 Dec 2020
Walter Roberson
on 28 Dec 2020
Edited: Walter Roberson
on 28 Dec 2020
What is the error you get? And which release are you using?
NIKHIL
on 29 Dec 2020
Walter Roberson
on 29 Dec 2020
You are wanting to do
A = "National"
and you say that you do NOT get an error when you do so. So what is the problem when you do use
A = "National"
?
NIKHIL
on 29 Dec 2020
Walter Roberson
on 29 Dec 2020
https://www.mathworks.com/help/stateflow/ug/string-data-in-charts.html
Answers (0)
Categories
Find more on Programmatic Model Editing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!