From: Abhishek on
>ya i think really sleepy bcz
when i run
TL4=subsref(vertcat(TL4{2:end}),struct('type','()','subs',{{':',2}}));
it returns<46*1cell>
and
TL4(1)

ans =


answers are empty
not working at all ;;;;
any other way if u can suggest??
From: Walter Roberson on
Abhishek wrote:
>> ya i think really sleepy bcz
> when i run
> TL4=subsref(vertcat(TL4{2:end}),struct('type','()','subs',{{':',2}}));
> it returns<46*1cell>
> and
> TL4(1)
>
> ans =
>
>
> answers are empty
> not working at all ;;;;
> any other way if u can suggest??

The code was tested.

>> TL4={'hello' [1 2] [3 4] [5 6]}
TL4 =
'hello' [1x2 double] [1x2 double] [1x2 double]
>> subsref(vertcat(TL4{2:end}),struct('type','()','subs',{{':',2}}))
ans =
2
4
6

>> TL4{:}
ans =
hello
ans =
1 2
ans =
3 4
ans =
5 6


This sample input is consistent with what you showed for TL4. I do not
recommend that you waste people's time by posting questions without
giving all the relevant information. You asked for the second value from
each line, and if your lines were character data instead of numeric
arrays, the second value would be the second character rather than the
second blank-delimited string.

Are you expecting the result to be numeric or a string?


>> TL4={'hello' '1 2' '3 4' '5 6'}
TL4 =
'hello' '1 2' '3 4' '5 6'

>> subsref(str2num(char(TL4(2:end))),struct('type','()','subs',{{':',2}}))

ans =
2
4
6
>> class(ans)
ans =
double
From: Oleg Komarov on
@Walter
I guess it is not double:

A = {'0.0000000e+00 7.6815589e-08'};
A{:}
ans =
0.0000000e+00 7.6815589e-08

Oleg
From: Abhishek on
Walter Roberson <roberson(a)hushmail.com> wrote in message <EZa2o.24300$KT3.11592(a)newsfe13.iad>...
> Abhishek wrote:
> >> ya i think really sleepy bcz
> > when i run
> > TL4=subsref(vertcat(TL4{2:end}),struct('type','()','subs',{{':',2}}));
> > it returns<46*1cell>
> > and
> > TL4(1)
> >
> > ans =
> >
> >
> > answers are empty
> > not working at all ;;;;
> > any other way if u can suggest??
>
> The code was tested.
>
> >> TL4={'hello' [1 2] [3 4] [5 6]}
> TL4 =
> 'hello' [1x2 double] [1x2 double] [1x2 double]
> >> subsref(vertcat(TL4{2:end}),struct('type','()','subs',{{':',2}}))
> ans =
> 2
> 4
> 6
>
> >> TL4{:}
> ans =
> hello
> ans =
> 1 2
> ans =
> 3 4
> ans =
> 5 6
>
>
> This sample input is consistent with what you showed for TL4. I do not
> recommend that you waste people's time by posting questions without
> giving all the relevant information. You asked for the second value from
> each line, and if your lines were character data instead of numeric
> arrays, the second value would be the second character rather than the
> second blank-delimited string.
>
> Are you expecting the result to be numeric or a string?
>
>
> >> TL4={'hello' '1 2' '3 4' '5 6'}
> TL4 =
> 'hello' '1 2' '3 4' '5 6'
>
> >> subsref(str2num(char(TL4(2:end))),struct('type','()','subs',{{':',2}}))
>
> ans =
> 2
> 4
> 6
> >> class(ans)
> ans =
> double
>ya it is not double so the second statement subsref(str2num(char(TL4(2:end))),struct('type','()','subs',{{':',2}}))
works

>thanks