请问冒号表达式左右两端不能是变量吗?。

xda1=r:0.001:100;其中为我算出的数值81,7.不过带入这个式子中结果??? Error using ==> colon
Colon operands must be real scalars.
Error in ==> csgji_nhyd>pushbutton29_Callback at 460
xda1=r:0.001:(n(m)+20);

 採用された回答

nakevo
nakevo 2022 年 11 月 23 日

0 投票

m = size(n); 得到的m 是一个向量,得到的 n(m) 也是向量
你要么把m = size(n); 换成 m = length(n),要么把 n(m) 换成 n(end)

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB 快速入门 についてさらに検索

タグ

質問済み:

2022 年 11 月 23 日

回答済み:

2022 年 11 月 23 日

Community Treasure Hunt

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

Start Hunting!