フィルターのクリア

How can I read a text file as fixed width columns?

5 ビュー (過去 30 日間)
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD 2017 年 8 月 30 日
コメント済み: MAHMOUD ALZIOUD 2017 年 8 月 31 日
Hello,
I have a traffic cards with information about traffic every 15 minutes, over one year I will have 2500 rows in every card. each row must be divided into 25 columns with a fixed width as shown in the next line.
Column widths: 1 2 6 1 1 2 2 2 2 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 how can I do this in matlab please?
  1 件のコメント
Jan
Jan 2017 年 8 月 30 日
What is a traffic card? What exactly is your input. Text files?

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

採用された回答

dpb
dpb 2017 年 8 月 31 日
編集済み: dpb 2017 年 8 月 31 日
cw=[1 2 6 1 1 2 2 2 2 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5];
fmt=sprintf('%%%dd',cw);
% file open preamble code here for opening file, return valid fid
data=cell2mat(textscan(fid,fmt,'collectoutput',1));
Above presumes all are integer fields, if data does include floating point values fix up format fields to match.
PS: Do not use user ids for tags in future...
  1 件のコメント
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD 2017 年 8 月 31 日
thank you very very much for your help

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by