フィルターのクリア

from TXT file to a matrix in matlab

1 回表示 (過去 30 日間)
Alexandru Stan
Alexandru Stan 2013 年 5 月 30 日
Hi guys,
I have a text file with manny lines like this:
At (18.0,6.1) BX = -0.0242048317383725
At (18.0,6.1) BY = -0.186458932104758
At (18.0,6.3) BX = -0.0274870529222169
At (18.0,6.3) BY = -0.226398264696909
At (18.0,6.5) BX = -0.0307692741060612
At (18.0,6.5) BY = -0.266337597289061
I want to make two matrices (one with Bx and other with By), each one with three columns X Y Bx and X Y By. Can someone help me?

採用された回答

Alexandru Stan
Alexandru Stan 2013 年 5 月 30 日
Thanks, I used Import Data menu but this is better...

その他の回答 (1 件)

Eugene
Eugene 2013 年 5 月 30 日
Try this
>> [x y dir B] = textread('tt.txt','At (%f,%f) B%c = %f');
>> ax = [x(dir=='X') y(dir=='X') B(dir=='X')]
ax =
18.0000 6.1000 -0.0242
18.0000 6.3000 -0.0275
18.0000 6.5000 -0.0308
>> ay = [x(dir=='Y') y(dir=='Y') B(dir=='Y')]
ay =
18.0000 6.1000 -0.1865
18.0000 6.3000 -0.2264
18.0000 6.5000 -0.2663
>>

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by