combining string and numerical values
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Andrew Waller
am 30 Sep. 2016
Kommentiert: Andrew Waller
am 30 Sep. 2016
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 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Characters and Strings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!