I changed the format of the script file from the default to long, and when I type a variable name into the command window it outputs in long format, but not when I try and output it using fprintf. x is a column vector that I want the results of in long format, each output in the same line as their variable names.
format longfprintf('X1 = %f', x(1))
This outputs
X1 = 1.598803
If I just typed 'x(1)' into the command window, the output is 1.598802934802056, which is the number of decimal points that I want. I know I can just hard code it to have 15 decimal points in the fprintf line, but why doesn't it just accept the format I specified earlier?
Best Answer