Info

This question is closed. Reopen it to edit or answer.

Problem with format rational

1 view (last 30 days)
ErikJon Pérez Mardaras
ErikJon Pérez Mardaras on 5 Feb 2021
Closed: John D'Errico on 5 Feb 2021
I think this question is more direct, specific and right to the issue than the previous one.
The point is that I have a great script with several calls to several mini-scripts inside it. Each mini-script makes some calculations and operations.
Okay, so there is a moment in the second mini-script in which I need to use
format rational
to make some calculations, and then, I like to return to the default format by matlab (which, according to what I have read in Matlab forum, is format short) so the code could return me values with decimals. So, to do so, I write
format short
But the issue is that the following results and calculations that Matlab will give me, they are all of them in format rational, it doesn't give me results in format shor anymore.
It seems I cannot use format rational once and then get rid of it. It seems that once I use format rational, it stays forever in the code. How can ressolve that? What an I doing wrong? I even tried writing just
format
instead of format short, but still doesn`t work.
I only want to use format rational in a scpecific part of that mini-script and then go back using format short (the default one) for the rest of the code.
Thank you!
  1 Comment
John D'Errico
John D'Errico on 5 Feb 2021
Please. This is NOT a new question. Your problem is that your variables are symbolic. rational format has NOTHING to do with symbolic expressions.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by