Unable to unclude special characters in the value of a parameter
1 回表示 (過去 30 日間)
古いコメントを表示
Hi Guys,
I am adding a block to a pre loaded simulink system. After adding the block i need to set a specific parameter to this block of the name P and value being a dynamic value. I am using:
p = add_block('uupilib/Get data from PI-point', [par, '/', nam], 'Position', pos);
set_param(p, 'P', ['Pin(', num2str(i), ')']);
However, when i'm trying to change this to:
p = add_block('uupilib/Get data from PI-point', [par, '/', nam], 'Position', pos);
set_param(p, 'P', Pin(i).PITag);
It says "Unexpected MATLAB expression". From what i've discovered it seems that the value Pin(i).PITag contains special characters such as semi colon(;) and spaces( ). When I replace this entire string with a simple 'abc', it works again. Is there a way that i can ask MATLAB to escape these special characters?
This statement is in a loop and i here is the loop counter variable.
0 件のコメント
回答 (1 件)
A Jenkins
2015 年 1 月 19 日
編集済み: A Jenkins
2015 年 1 月 19 日
2 件のコメント
A Jenkins
2015 年 1 月 19 日
For the built in examples of how to do the replacement yourself, type doc regexprep.
There are also some people here who enjoy these puzzles for some strange reason. I bet if you put an example up (before and after of what you would like the string to be), someone would write the regular expression for you.
参考
カテゴリ
Help Center および File Exchange で Naming Conventions についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!