- Non-alphabetic characters like spaces and dots get converted to underscores, which ARE allowed in MATLAB.
- Variable names cannot start with a number, so if your block starts with one then it appends an "x" in front of it.
What is the function behind renaming Simscape Blocks in the Simscape Results Explorer?
1 次查看(过去 30 天)
显示 更早的评论
Hello I have created a script in Matlab making analyses and calculations out of Simulink/Simscape simulation by reading the 'simlog' variable. The problem is, that the Simscape Blocks are renamed in the structure of 'simlog' in the same way, as they are renamed in the Simscape Results Explorer. For instants 'Chamber 5' is renamed to 'Chamber_5'. Ok this is a easy example, which could be solved by replacing ' ' with '_'. But '1.1 - 1.2' is replaced by 'x1_1_1_2'. Now is my question, what is the function behind this renaming process? How can find out, which name my component will get in the 'simlog' variable. Thanks in advanced Cedric
0 个评论
采纳的回答
Sebastian Castro
2015-8-20
The rules that come into play here are not that bad, and all due to MATLAB's restrictions on variable names
I'd recommend keeping the block names simple, and using Block Annotations to add any fancy numbers and other characters.
- Sebastian
更多回答(1 个)
Steven Lord
2015-8-20
Variable names in MATLAB must start with a letter. That string looks like it was created using matlab.lang.makeValidName or perhaps genvarname.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating Custom Components and Libraries 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!