Error Dot indexing is not supported for variables of this type in d.getLinkLenght EPANET Toolkit
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Shubham
el 18 de Dic. de 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 comentarios
Ver también
Categorías
Más información sobre Weather and Atmospheric Science en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!