str=[' the value of pi ='num2str(pi)];
disp(str)
本人认为是对的为什么不能执行。
str=[' the value of pi ='num2str(pi)];
disp(str)
本人认为是对的为什么不能执行。
matlab将字符串中的每个字符作为元素,按照行向量的形式存储字符串,参照行向量的规则进行向量的运算。num2str返回一个新的字符串,将两个字符串相连时,除了使用matlab现有的函数外(具体名字忘了),在运用lz的格式时,应该使用行向量相连的规则,在两个向量间使用空格或“,”分隔开。
以下为正确格式:
str=[' the value of pi =' num2str(pi)];
或
str=[' the value of pi =',num2str(pi)];
vBulletin® v3.8.3,版权所有 ©2000-2025,Jelsoft Enterprises Ltd.