Workspace calculation accuracy 7 characters

1 view (last 30 days)
Hello! Faced a problem, I need to copy the numbers 7 and more characters for later work in text formats
format long g
digitsOld = digits(20);
a = 20.224124124124;
b = 7664555.5789;
x1 = double(y)/b;
x2 = exp(double(x1));
x3 = 5*sin(x2)-pi/2;
x4 = 10*sin(x2)-pi/2;
Aanswer = x2*a;
Banswer = x4*a;
Canswer=x3*a-1.22;
disp(double(Aanswer))
for j = 1:length(Aanswer)
va = ['Aanswer_',num2str(j)];
eval([vn,'=Aanswer(j)']);
end
I have two problems, the first all my values ​​are written in the workspace and there are a lot of them, can I group them all (create Aanswer 1x30000), the second problem in the workspace they are written only 6 characters (when using edit I can see all the other characters and I would like to save them for future work)

Accepted Answer

Rik
Rik on 2 Aug 2019
There is a big difference between the display of values and how they're stored. They aren't stored in a decimal form (maybe with the symbolic toolbox there is an exception), but in binary.
You don't need numbered variables or eval, but you need to learn about the sprintf and fprintf functions if you want to export values to another program.

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!