From: Faraz Afzal on
Hi everyone,

I came across a problem and I am unable to workout even after trying with textscan,fscanf, and whatever i can.. I don't know where I am doing wrong.

I have a software that would generate my simulation results in this format,

[[0.990272;0.108886;-0.0866375],[-0.108472;0.994054;0.00949007],[0.0871557;0;0.996195]][7.01034;-0.525157;0][1.0447;5.13572;-3.51292][0.0544432;0.497027;0.458227][-8.15878;0.14572;-2.61607][0.260417;0.273269;-0.470216]


This is just one of the rows of text at some instant t1....And I have similar data for upto tn where n = varies in each simulation and could go upto 1000..

Now i want to scan just the numerical values and assign them to a matrix.

Can anyone show me how would i do that... Rows are messed up with the square brackets..

Regards,
Faraz
From: Walter Roberson on
Faraz Afzal wrote:
> I have a software that would generate my simulation results in this format,
> [[0.990272;0.108886;-0.0866375],[-0.108472;0.994054;0.00949007],[0.0871557;0;0.996195]][7.01034;-0.525157;0][1.0447;5.13572;-3.51292][0.0544432;0.497027;0.458227][-8.15878;0.14572;-2.61607][0.260417;0.273269;-0.470216]

> Now i want to scan just the numerical values and assign them to a matrix.
>
> Can anyone show me how would i do that... Rows are messed up with the
> square brackets..

You could use textscan() with a Delimiter parameter of '[],;' and
MultipleDelimsAsOne set to 1 .
From: Faraz Afzal on
Walter Roberson <roberson(a)hushmail.com> wrote in message <i0t6j4$46l$1(a)canopus.cc.umanitoba.ca>...
> Faraz Afzal wrote:
> > I have a software that would generate my simulation results in this format,
> > [[0.990272;0.108886;-0.0866375],[-0.108472;0.994054;0.00949007],[0.0871557;0;0.996195]][7.01034;-0.525157;0][1.0447;5.13572;-3.51292][0.0544432;0.497027;0.458227][-8.15878;0.14572;-2.61607][0.260417;0.273269;-0.470216]
>
> > Now i want to scan just the numerical values and assign them to a matrix.
> >
> > Can anyone show me how would i do that... Rows are messed up with the
> > square brackets..
>
> You could use textscan() with a Delimiter parameter of '[],;' and
> MultipleDelimsAsOne set to 1 .

Still some errors...
I am not even able to move a single line..
even in a one single line i have no progress..
This is what i wrote for a single row above,

S = '[[0.990272;0.108886;-0.0866375],[-0.108472;0.994054;0.00949007],[0.0871557;0;0.996195]][7.01034;-0.525157;0][1.0447;5.13572;-3.51292][0.0544432;0.497027;0.458227][-8.15878;0.14572;-2.61607][0.260417;0.273269;-0.470216]'
KK = textscan(S, '[[],;')

i get an empty cell..
From: Walter Roberson on
Faraz Afzal wrote:
> Walter Roberson <roberson(a)hushmail.com> wrote in message
> <i0t6j4$46l$1(a)canopus.cc.umanitoba.ca>...
>> Faraz Afzal wrote:
>> > I have a software that would generate my simulation results in this
>> format,
>> >
>> [[0.990272;0.108886;-0.0866375],[-0.108472;0.994054;0.00949007],[0.0871557;0;0.996195]][7.01034;-0.525157;0][1.0447;5.13572;-3.51292][0.0544432;0.497027;0.458227][-8.15878;0.14572;-2.61607][0.260417;0.273269;-0.470216]
>>
>> > Now i want to scan just the numerical values and assign them to a
>> matrix.
>> > > Can anyone show me how would i do that... Rows are messed up with
>> the > square brackets..
>>
>> You could use textscan() with a Delimiter parameter of '[],;' and
>> MultipleDelimsAsOne set to 1 .
>
> Still some errors...
> I am not even able to move a single line..
> even in a one single line i have no progress..
> This is what i wrote for a single row above,
>
> S =
> '[[0.990272;0.108886;-0.0866375],[-0.108472;0.994054;0.00949007],[0.0871557;0;0.996195]][7.01034;-0.525157;0][1.0447;5.13572;-3.51292][0.0544432;0.497027;0.458227][-8.15878;0.14572;-2.61607][0.260417;0.273269;-0.470216]'
>
> KK = textscan(S, '[[],;')
>
> i get an empty cell..

>> textscan(S,'%f','Delimiter','[],;','MultipleDelimsAsOne',1)
ans =
[24x1 double]
From: us on
"Faraz Afzal"
> S = '[[0.990272;0.108886;-0.0866375],[-0.108472;0.994054;0.00949007],[0.0871557;0;0.996195]][7.01034;-0.525157;0][1.0447;5.13572;-3.51292][0.0544432;0.497027;0.458227][-8.15878;0.14572;-2.61607][0.260417;0.273269;-0.470216]'
> KK = textscan(S, '[[],;')
>
> i get an empty cell..

well, of course: this is NOT the correct syntax...
peruse the help, again...

help textread;
help textscan;

us