Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoding scalar values into array unnecessarily #70

Closed
wrgrant opened this issue Oct 2, 2020 · 1 comment
Closed

Encoding scalar values into array unnecessarily #70

wrgrant opened this issue Oct 2, 2020 · 1 comment

Comments

@wrgrant
Copy link
Contributor

wrgrant commented Oct 2, 2020

Last one (for now) 馃槈

I notice that in this line you are packing scalar values into an array.
But only for floats. Integers don't do this.

Is this a bug or is this expected behavior?

With the current behavior, I end up with interesting data results such as this attached image (after pulling into JavaScript). Note, the single integer is placed directly as a scalar, while the single float value is packed into a single element array.

2020-10-01_17h06_01

I found that changing the float encoding line to:
txt=D_(mat,varargin{:});
yielded what I expect to be correct results.

But I'm curious if there is some other design decision that this change would break?

@fangq fangq closed this as completed in 632531f Jun 23, 2021
@fangq
Copy link
Owner

fangq commented Jun 23, 2021

sorry, did not pay attention to my notifications until now.

I agree this is an inconsistency in the code. I believe this was more of a historical reason why it was written this way.

I made the above commit and it should now output single float value if the SingletArray flag is 0 (default).

let me know if this patch works for you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants