Error Dot indexing is not supported for variables of this type in d.getLinkLenght EPANET Toolkit
2 views (last 30 days)
Show older comments
Hi, I have a problem in my code.
First I call to
start_toolkit;
inpname='Net.inp';
d=epanet(inpname);
....
d.setLinkDiameter(Index_Pipe,D);
I haven't problems calling the functions, until it appears this error. Dot indexing is not supported for variables of this type.
Error in CodeESP (line 220)
d.setLinkDiameter(Index_Pipe,D);
0 Comments
Answers (1)
Shubham
on 18 Dec 2023
I understand that you are using EPANET toolkit. You used “epanet” function to create an object for EPANET toolkit interface and tried to access the method “setLinkDiameter” which produced the error: “Dot indexing is not supported.”
Dot indexing is used for accessing the fields in struct or methods in objects. The error regarding dot indexing suggests that the variable ‘d’ is not an object or struct.
You can check if EPANET object is initialized correctly. Ensure that the object creation does not raise any errors. You can also use the “whos” command to check the type of variable:
inpname='Net.inp';
d=epanet(inpname);
whos d
You can also check if the variable was overwritten before accessing the “setLinkDiameter” method. Have a look at the following code snippet:
d = 5;
disp(d);
d = struct('Name','Alice','Age',25);
disp(d.Name);
whos d;
d=10;
disp(d.Name);
In the above code snippet, the variable 'd' is overwritten and when the field 'Name' is accessed using the variable 'd', it produces same error.
Also have a look at these previous MATLAB Answer cases that might help you:
Hope this helps!!
2 Comments
See Also
Categories
Find more on Weather and Atmospheric Science in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!