why fread showing too many output arguments?

I have a function which reads a binary file and extracts the data. I already have entire code. I am trying to run it, but it shows error at
[nmass, nr, np, nk, nm] = fread(id, 5, 'int');
Error using fread
Too many output arguments.
I have a 5D binary data file and trying to extract the data from that file.
Any suggestions, why it is stuck at this point?
Thank you in advance.

2 Comments

"Any suggestions, why it is stuck at this point?"
As the FREAD documentation explains, FREAD returns all of the data in its first output:
The second output (the number of characters read) is not commonly used. In any case, it certainly does not support five output arguments as you show.
Aha! I did that trial an error before.
I get 5-values when I run:
[nmass] = fread(id, 5, 'int');
So, does that mean 5-values represents 5-different parameters?

Sign in to comment.

 Accepted Answer

Stephen23
Stephen23 on 5 Apr 2023
Moved: Rik on 5 Apr 2023
"So, does that mean 5-values represents 5-different parameters?"
Yes, if that is what your file contains and the FREAD command is correctly specified for importing that file data.

4 Comments

MP
MP on 5 Apr 2023
Moved: Rik on 5 Apr 2023
@Stephen23 Thank you very much, I got it clear.
MP
MP on 5 Apr 2023
Moved: Rik on 5 Apr 2023
How to accept your answer? i do not see the button.
I moved the comments so the answer can be excepted.
Thank you Rik

Sign in to comment.

More Answers (0)

Categories

Asked:

MP
on 5 Apr 2023

Commented:

MP
on 6 Apr 2023

Community Treasure Hunt

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

Start Hunting!