Effacer les filtres
Effacer les filtres

x=dir('c:\mydir') ; x(1).name = '49' ??? weird output bug

1 vue (au cours des 30 derniers jours)
Rory
Rory le 4 Déc 2011
Hi all
I was using the dir function to get a list of the subdirectories in a folder. Everything looks correct when I view the values of the output structure. However, when I want to assign the name values into a string array (to be used later as a loop indexer) the string values of the names that are assigned to my string array elements are all '49' ! This seems like something is not going right... I have tried using explicit loops and using : notation to assign the values but neither way works right.
Thanks in advance
  2 commentaires
Sven
Sven le 5 Déc 2011
Can you show code beyond what's in the title of this post?
The code there indicates that you are *setting* the first element of the structure "x" to be the string '49'. Is this what you intended? Your question seems to be about doing something with a string array (rather than the structure output of "dir"), so it's a little unclear.
Jan
Jan le 5 Déc 2011
Without seeing the code, we cannot guess, what's going wrong.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur File Operations dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by