Borrar filtros
Borrar filtros

from TXT file to a matrix in matlab

1 visualización (últimos 30 días)
Alexandru Stan
Alexandru Stan el 30 de Mayo de 2013
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?

Respuesta aceptada

Alexandru Stan
Alexandru Stan el 30 de Mayo de 2013
Thanks, I used Import Data menu but this is better...

Más respuestas (1)

Eugene
Eugene el 30 de Mayo de 2013
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
>>

Categorías

Más información sobre Environment and Settings en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by