Effacer les filtres
Effacer les filtres

The Output structure of a code is showing different outputs in command window and workspace

131 vues (au cours des 30 derniers jours)
When working on a program, after executing it and checking output in MATLAB command window and in output from workspace is giving different outputs. Which is correct output here and what is this happening?
Command window output:
  11 commentaires
Manikanta Aditya
Manikanta Aditya le 15 Juil 2024 à 8:41
Yes, struct shows all fields, disp is not.
Manikanta Aditya
Manikanta Aditya le 16 Juil 2024 à 3:29
Thank you @dpb, @John D'Errico, @Walter Roberson everyone for your help!
I understood the issue here, whatever the file output is, the command window output is the correct and respective output. In workspace output struct, it was displaying all the outputs irrespective of any format, so I understood this is expected, hence this clarifies my query, Thanks again!

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 13 Juil 2024 à 17:27
The command window version is the result of an implicit execution of the display method. The display method examines the object details and displays whichever parts of it that it believes to be important, in whatever order it feels are important.
The workspace output examines the result of executing struct on the object. Hidden properties are exposed. Internal order is used.

Plus de réponses (1)

dpb
dpb le 13 Juil 2024 à 15:57
As @John D'Errico says, they're both correct only the workspace browser has unfolded the various struct content that is only displayed as the struct, not the content of the struct in command window. So, there's more to the struct than is just displayed at the command window, but it would be very annoying if the command window expanded everything...
  4 commentaires
Manikanta Aditya
Manikanta Aditya le 13 Juil 2024 à 18:47
@dpb, I am still working on the code, but thanks for the help!
Manikanta Aditya
Manikanta Aditya le 13 Juil 2024 à 18:50
What is returned will be totally dependent upon what the content of what was read is and how it was read -- if the reader is returning ng data, it must be in the file regardless the extension that was used for the file
This is not possible for sure, the format files are different as they are meant to be.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Software Development Tools dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by