0

I created a function that generates a structure to store parameters acquired during a simulation. Some parameters are int32, while other (actually, most of them) are float. The structure is generated correctly (no errors during execution) but for some reasons, only the int32 values are shown correctly. I suppose there is some kind of format incompatibility between int32 and single.

This is what I get after the simulation ends

enter image description here

int32 parameters are highlighted in yellow and are stored correctly in the "Value" column of the structure, while the float values are seemingly converted into something else when the structure is generated (for example, the fifth value in red is 0.9391 during the aquisition, but then stored as 1 in the structure).

Why does this happen? Is there a way I can convert those values without losing information? I need them to be stored in the same structure, since they are all parameters concerning the same appliance.

EDIT: Apparently, it is just a visualization issue. The value is stored correctly, but displayed wrong. Is there a way to change this?

Bianca
  • 149
  • 2
  • 10
  • There is a difference between display and storage. What are they actually *stored* as? Use [`class`](https://www.mathworks.com/help/matlab/ref/class.html). – sco1 Apr 22 '17 at 13:56
  • It concerns only a visualization problem. `JointData(6).Parameters.Value` will return the correct value. Matlab seems to select its formatting style based on the first element. – m7913d Apr 22 '17 at 13:57
  • You are indeed right, the stored value is correct. Thanks. Still, is there any way to visualize each value in its own format in the workspace? It would be convenient. – Bianca Apr 22 '17 at 14:19
  • I don't think so, except for changing the data type to float always. – m7913d Apr 22 '17 at 15:41
  • Maybe you can report it as a Matlab bug/feature request to Mathworks. – m7913d Apr 22 '17 at 15:43

0 Answers0