How to use .name?
Mostrar comentarios más antiguos
What does it mean when I write this line PicName = CylinderFile(1).name
It is extracting the picture/figure of the cylinder. when I run it, it says Index exceeds array bounds. for this line.
3 comentarios
"What does it mean when I write this line PicName = CylinderFile(1).name"
Possibly the first element of the structure returned by dir, which would contain the name of a file or a folder. But this is just a guess, because you did not give us any context for that code.
"when I run it, it says Index exceeds array bounds. for this line."
Then I guess dir did not find any files/folders that matched the pattern you gave it.
Fahad Obaid
el 16 de Oct. de 2018
Editada: Fahad Obaid
el 16 de Oct. de 2018
"You were right the structure returned by dir, and my question now about the parentheses it has 1 as a value. Should it have a name of the folder instead."
The structure returned by dir can be accessed using indexing, so what your code does is perfectly valud code: it accesses the first element of that structure. If there are no elements, then you will need to figure out why dir did not match anything.
Respuestas (0)
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!