Expected one output from a curly brace or dot indexing expression

27 views (last 30 days)
Honey on 30 Nov 2021
Commented: Benjamin on 1 Dec 2021
I want to save my data in a cell file with "n" number of struct and two order dot indexing like below.
But I recived this error. I want to know it is not really possible to use 3 order dot indexing in a mat file?
Error in Pixel_to_Point (line 29)
Expected one output from a curly brace or dot indexing expression, but there were 3 results.
  1 Comment
Stephen on 1 Dec 2021
"I want to know it is not really possible to use 3 order dot indexing in a mat file?"
It is certainly possible. But one of your cell arrays or structures or indices is non-scalar, and that causes the error.

Sign in to comment.

Answers (2)

Matt J
Matt J on 30 Nov 2021
The issue you are seeing has nothing to do with mat files. The expression that you've shown can only work if n is a scalar.
Matt J
Matt J on 30 Nov 2021
I suggest you attach a .mat file containing all the variables in that line of code....Data, Data_IMERG, St_Name, month, day ..... so that we can better examine what is happening in that line

Sign in to comment.

Benjamin on 30 Nov 2021
Is St_Name a length-3 character vector, .e.g., 'acb', by chance? I ask because it doesn't seem likely that St_Name can be used as the name of a field of a struct [".(St_Name)"] and also an index ["IMERG(St_Name,1)"]. I'm guessing it is a length-3 character vector which is used as indices into Data{n}.IMERG, returning 3 results, hence the error.
So I would check that the expression is correct as written, and if it is, let us know what some of these variables are. There is nothing wrong with multiple dot expressions per se.
Benjamin on 1 Dec 2021
@Honey: What kind of variable is Data{n}.IMERG? What do you expect Data{n}.IMERG(St_Name,1) to be?
Like I said, this expression:
is using St_Name as an index into Data{n}.IMERG, which I don't believe is what you intend to do and I believe is the source of the error. The other expression, which works fine:
does not use St_Name as an index into Data{n}.IMERG. Therefore, I suspect you have a syntax error in the first expression. Without knowing what your intent is in writing that expression, I have no way to know what it should be, but the answer to your original question is clear: It is possible to use 3 dot indexing operations in a single expression (regardless of whether the variable is from a .mat file).

Sign in to comment.




Community Treasure Hunt

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

Start Hunting!

Translated by