turn a variable value into a string in matlab

You can use the built-in function num2str to convert a numeric variable into a string. Here's an example:

main.m
num = 123;    % numeric variable
str = num2str(num);    % convert to string
76 chars
3 lines

In this example, num has the value 123, and the num2str function is used to convert it to a string. The resulting string is stored in the variable str.

related categories

gistlibby LogSnag