I am trying to test a part of my code but it shows me this message ! how can i solve it , Help plz !
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Sura Hatem Basir Al-Ani
el 5 de Mzo. de 2021
Comentada: Walter Roberson
el 5 de Mzo. de 2021
I am trying to test a part of my code but it shows me this message ! how can i solve it , Help plz !
Cannot find an exact (case-sensitive) match for 'Material'
The closest match is: material in D:\toolbox\matlab\graph3d\material.m
2 comentarios
Jorg Woehl
el 5 de Mzo. de 2021
Are you trying to execute code that you have saved to a file called Material.m?
If that's the case, make sure to first navigate to the folder containing Material.m before calling Material from the command line.
Respuestas (2)
KALYAN ACHARJYA
el 5 de Mzo. de 2021
Editada: KALYAN ACHARJYA
el 5 de Mzo. de 2021
This is due to a name mismatch between the upper case or lower case in the custom function name. Matlab is case-sensitive. Modify either in the function name or the main script.
2 comentarios
Walter Roberson
el 5 de Mzo. de 2021
... or it could mean that you really did mean Material with a capital but that there is no function named Material in the MATLAB path.
... or it could mean that you were use a matrix named Material but that matrix is not defined at that point in the code.
Walter Roberson
el 5 de Mzo. de 2021
for k=1:1:lenght(Material)
You have not defined any variable named Material but you have defined a variable named material . As you are looping over the number of elements of something and inside that loop you access material() indexed by the loop variable, it would be most natural to take the length of material rather than of whatever Material is.
CF=material(k).CF;
S_y=material(k).S_y*10e6;
allow_stress=S_y/n_d;
end
for x=1:3:lenght(material(x).t)
t=material(x).t(x)/1000;
z=H/2-t;
end
Please also pay attention to the fact that in both of those for loops you use a function named lenght when you probably intended length -- ht compared to th
3 comentarios
Rik
el 5 de Mzo. de 2021
That means that you are trying to get the 8th element from a list that is 7 elements long.
Walter Roberson
el 5 de Mzo. de 2021
for nux=1:3:lenght(material(x).t)
t=material(x).t(x)/1000;
z=H/2-t;
end
You are taking whatever value if x is left over in memory and using it to index the material structure, and you find the length of the t field there. You use that length as the upper limit in a for x loop. You then use that to index the material structure and pull out the t field and then you use the same index to index the t vector. This is sort of like going down the diagonal
For example if the value of x in memory happened to be 2 then you would have taken length of material(2).t which is 12. You would then be doing for x = 1:3:12. You would access materials(1).t(1) then materials(4).t(4) then materials(7).t(7) but that would fail because materials(7).t is only 6 elements long.
Note also that when you succeed in indexing the t vector that you calculate z. However you do not save the value and it will be overwritten by the next for x iteration.
Ver también
Categorías
Más información sobre Particle & Nuclear Physics 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!