Argument to dynamic structure reference must evaluate to a valid field name???

I know there are multiple posts about this error but unfortuantely none of them were in my context. Which is:
I trained a neural network using the fitrnet matlab command and got a neural network that we will call NET. NET accepts 7 inputs in row array format and outputs to me a single number. But for some reason when I try to simulate the network using, for example,
x=[1,2,3,4,5,6,7;8,9,10,11,12,13,14;15,16,17,18,19,20,21];
Result = NET.predict(x(1,:))
I get the error message given in the title of my post. I dont really know where to go from here. Its not a very describtive error message.

4 Comments

I am guessing that your actual code is slightly different to that which you have posted:
NET.predict = pi;
x=[1,2,3,4,5,6,7;8,9,10,11,12,13,14;15,16,17,18,19,20,21];
Result = NET.predict.(x(1,:))
Argument to dynamic structure reference must evaluate to a valid field name.
No its actually exactly the same. NET is a neural network which I trained using the fitrnet command (https://www.mathworks.com/help/stats/fitrnet.html), after the training is done, the output is a neural network called NET that has an attribute called predict which you can pass to this array and get an output like I described. At least thats what the documentation says.
@Ali Almakhmari: please post the complete error message. This means all of the red text.
In addition to posting the complete error message, please show the exact code that you're running that causes that error to be thrown and show us exactly what the variables used in that section of code are (sizes and classes.) You can collect the size and class information by using the whos command, like:
x = magic(4);
y = "Massachusetts";
whos x y
Name Size Bytes Class Attributes x 4x4 128 double y 1x1 162 string

Sign in to comment.

Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Products

Release

R2022b

Asked:

on 15 Sep 2023

Commented:

on 15 Sep 2023

Community Treasure Hunt

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

Start Hunting!