Create string from list of names in file

1 回表示 (過去 30 日間)
Cg Gc
Cg Gc 2019 年 1 月 2 日
編集済み: Cg Gc 2019 年 1 月 2 日
I have an unusual problem. I am running a program that generates a list of file names (see example, CLUSLIST_5). In this file, there are several columns, of which only the first and the last are important to me. The first is a group number (1,2,3,4,5) and the last is a file name (tdump84...). The group numbers stay the same; there will always be 5 groups. The number within each group and the names of the files will vary. I would like to create a string of the filenames for each group. The group number is not needed as part of the string, but can be part of the string name. I have several hundred of the lists of file names, so I will need something that can be repeatable.
I can generate a string of file names, but I am struggling with the varying number within each group part. How should I begin to account for the varying number within each group?
The file isn't actually a text file. It is a text file for uploading purposes here.
Thank you much.

採用された回答

KSSV
KSSV 2019 年 1 月 2 日
file = 'CLUSLIST_5.txt' ;
fid = fopen(file,'r') ;
S = textscan(fid,'%f %f %f %f %f %f %f %s') ;
fclose(fid) ;
str = S{8} ;
  1 件のコメント
Cg Gc
Cg Gc 2019 年 1 月 2 日
編集済み: Cg Gc 2019 年 1 月 2 日
This worked a treat. Thank you much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Export についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by