get the value of a variable in matlab

To get the value of a variable in Matlab, you can use either the disp() or the fprintf() function to print the value to the console. For example, if your variable is x, you can print its value using disp(x) or fprintf('The value of x is %d\n',x).

main.m
x = 10;
disp(x) % prints 10 to console
fprintf('The value of x is %d\n', x) % prints "The value of x is 10" to console
119 chars
4 lines

related categories

gistlibby LogSnag