combining string and numerical values
7 次查看(过去 30 天)
显示 更早的评论
Within my conditional analysis of a program I'm working on that basically evaluates partial derivatives to give characteristics of a function, I'm trying to combine a string 'a numerical example is' with a chosen number from an array (example(k)). I've tried a few different methods and I believe I need to utilize num2str but when I try to use it, I get back the error "Input to num2str must be numeric." which doesn't make sense because my value is in fact a number?
Just for trouble shooting purpose I tried int2string and was able to get a number but obviously I need the full number, not just an integer.
for k = 1:numel(B)
if (A(k))>0
if(B(k))<0
disp(['f(x,y) has a saddlepoint at' num2str(x_crit(k)) ])
end
end
end
If it helps these are the values I'm trying to call into the string. Thanks in advance for the help!
x_crit =
0
-13/10
13/10
0
0
-13/20
13/20
-13/20
13/20
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!