data import from txt file

4 ビュー (過去 30 日間)
Cem Eren Aslan
Cem Eren Aslan 2024 年 4 月 29 日
コメント済み: Cem Eren Aslan 2024 年 4 月 30 日
Hi all,
I try to import .txt files. These files contains a paragraph at the begining of the file and after these paragraph there are data consist of only one column and various rows. I write a matlab code but this code import the data as a "char". I want to import only data as a matrix and delete paragraph. How can i do that?
% Specify the location of GMs
path = 'C:\Users\Ssdadk\OneDrive\Parator\Deprem\GMs';
%Get all txt files
gm_list = dir(fullfile(path, '*.txt'));
% Create a cell to store GMs
gm_cell = cell(numel(gm_list),1);
% Read data set
for gm_index = 1:numel(gm_list)
gm_name = gm_list(gm_index).name;
gm_path = fullfile(path, gm_name);
gm_cell{gm_index} = fileread(gm_path);
end
Thanks...
  2 件のコメント
Stephen23
Stephen23 2024 年 4 月 29 日
Cem Eren Aslan
Cem Eren Aslan 2024 年 4 月 30 日
Thank you for your help. Problem solved.

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

回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by