how to make array from characters from variables ?

1 view (last 30 days)
pruth
pruth on 4 Nov 2015
Commented: Stephen on 4 Nov 2015
by trying a lot finally i m able to get my files from sub-folders... but now i m again stuck.
i have created a variables file with <<57*84 char >>see bellow.
val =
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140101010317_050_METOPA_37369_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140101024435_051_METOPA_37370_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140101042559_051_METOPA_37371_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140101060717_051_METOPA_37372_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140101074841_051_METOPA_37373_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140101093005_050_METOPA_37374_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140101111335_048_METOPA_37375_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140101125247_050_METOPA_37376_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140101143405_051_METOPA_37377_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140101161529_051_METOPA_37378_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140101175647_051_METOPA_37379_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140101193811_051_METOPA_37380_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140101211935_050_METOPA_37381_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140101230053_051_METOPA_37382_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140102004217_050_METOPA_37383_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140102022335_051_METOPA_37384_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140102040459_051_METOPA_37385_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140102054617_051_METOPA_37386_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140102072741_051_METOPA_37387_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140102090905_050_METOPA_37388_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140102105235_048_METOPA_37389_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140102123147_050_METOPA_37390_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140102141305_051_METOPA_37391_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140102155429_051_METOPA_37392_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140102173547_051_METOPA_37393_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140102191711_051_METOPA_37394_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140102205835_050_METOPA_37395_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140102223953_051_METOPA_37396_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140201001856_051_METOPA_37809_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140201020020_051_METOPA_37810_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140201034138_051_METOPA_37811_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140201052302_051_METOPA_37812_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140201070420_051_METOPA_37813_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140201084544_051_METOPA_37814_DLR_03.HDF5
GOME_O3-NO2-NO2Tropo-BrO-SO2-H2O-HCHO_L2_20140201102702_051_METOPA_37815_DLR_03.HDF5
each line is my file which i want for further opration. if i would make an array for these file names, it would be easy for me.but i don't know how make a loop to read these characters from variables . hope u understand my question.

Accepted Answer

the cyclist
the cyclist on 4 Nov 2015
Edited: the cyclist on 4 Nov 2015
Create a cell array out of the character array:
c = cellstr(val);
Then, each cell element is a string that can be used:
c{1}
for example, is the first string. (Notice the use of curly brackets there.) You can read more about the use of cell array in the documentation.
  1 Comment
Stephen
Stephen on 4 Nov 2015
Or without creating any intermediate cell array, simply use indexing directly:
for k = 1:size(val,1)
one_name = val(k,:);
... other code here
end

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by