Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
Rory
Rory il 4 Dic 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 Commenti
Sven
Sven il 5 Dic 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 il 5 Dic 2011
Without seeing the code, we cannot guess, what's going wrong.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su File Operations in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by