Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
Rory
Rory am 4 Dez. 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 Kommentare
Sven
Sven am 5 Dez. 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 am 5 Dez. 2011
Without seeing the code, we cannot guess, what's going wrong.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu File Operations finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by