Reputation: 43
Suppose I have a matrix A=[1,2] if I try to print it with command
fprintf("A ", A)
Output
A
Blank A
is printed without values?
Upvotes: 4
Views: 12617
Reputation: 104515
It's:
fprintf('A:\n');
fprintf('%f\n', A);
You need to specify a valid format specifier when displaying a variable. Doing %f\n
will print out a single value per line. Please read up on how to use format specifiers from the docs: https://www.gnu.org/software/octave/doc/v4.0.0/Formatted-Output.html#XREFsprintf
Upvotes: 9