How can i write from txt files to any array

1 回表示 (過去 30 日間)
erdem erdemm
erdem erdemm 2017 年 8 月 2 日
回答済み: erdem erdemm 2017 年 8 月 3 日
İ have any a txt files.
a001.txt
152 583 -129 -523 125 etc..
i want to use them in an array. i want to use each one like a quantitive number. as a result i want that k array is a.txt
k= 152 583 -129 -523 125
thanks

採用された回答

ES
ES 2017 年 8 月 2 日

その他の回答 (3 件)

KSSV
KSSV 2017 年 8 月 2 日
Read about load , importdata, textscan.

Jan
Jan 2017 年 8 月 2 日
[fid, msg] = fopen('a001.txt', 'r');
if fid == -1, error('Cannot open file: %s', msg); end
K = fscanf(fid, '%g ', Inf);
fclose(fid);
  3 件のコメント
erdem erdemm
erdem erdemm 2017 年 8 月 3 日
I have lots of .txt files until a100 . I want to increase automatically like a001 and a002 and a003 and ...... a100 . how could i write it . Have you got any idea ??
Thanks
erdem erdemm
erdem erdemm 2017 年 8 月 3 日
i use fopen, fscanf for a001.txt and than again i use the same code for a002.txt. ....etc... until a100.txt
thanks

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


erdem erdemm
erdem erdemm 2017 年 8 月 3 日
I have lots of .txt files from a001 to a100 . I automatically want to increase files name like a001 and a002 and a003 and ...... a100 .

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by