When using the 'set_param' function, how do I ensure that I format the parameter value properly when the parameter value is a 1xn array?

1 回表示 (過去 30 日間)
I'm trying to simulate a simple Doppler Radar and I need to change the frequency offset value per simulation, however this requires me to change the RFConfiguration block's fundamental tones, so I've written some code that's all working fine apart from this particular line:
set_param('Radar_Simulation/Configuration', 'Tones', [num2str(frequency_offset), num2str(f), num2str(f+frequency_offset)]);
As this gives the fundamental tones as:
0.005555810000001000000.0056
When they should be:
'[0.0055558 1000000 1000000.0056]'
So clearly whatever have done is taking into account the commas within my array or the square brackets themselves.

採用された回答

Fangjun Jiang
Fangjun Jiang 2021 年 5 月 6 日
how about this
a=1;b=2;c=3
mat2str([a,b,c])
ans =
'[1 2 3]'

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatched Filter and Ambiguity Function についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by