Re: convert value into variables



dave wrote:


andy wrote:


hello,

I have got a problem with converting value into variables.

I have a few data sets, one of the data set i've got are shown
below(the column number of a,b,c,d may varies):

a1 b c2 d
1 4 5 6
2 5 6 6
2 3 4 5

I would like to split the data so that

a1=[1;2;2],b=[4;5;3],c2=[5;6;4],d=[6;6;5]


help assignin
or
help eval

how can i do that?
Any ideas, please help, thanks!


Try this:

data={ 'a1' 'b' 'c2' 'd'
1 4 5 6
2 5 6 6
2 3 4 5};

[m,n]=size(data);

for i=1:n
assignin('base',char(data(1,i)),[data{2:end,i}]')
end

-Andrew
.



Relevant Pages

  • Re: convert value into variables
    ... andy wrote: ... I have got a problem with converting value into variables. ... below(the column number of a,b,c,d may varies): ...
    (comp.soft-sys.matlab)
  • Wed. 5/16 Big Show Synopsis
    ... Dave says he'd have to put Ricky Gervais' "The Office" right up there among the top shows in the history of television. ... we take a look at Andy visiting some area collectors. ... Hey, I recently bought a book on meditation. ...
    (alt.fan.letterman)
  • Re: Does Andy Dick have a publicist?
    ... think Andy was presenting schtick he thought was funny. ... Dave books him ... because he lets Dave beat him up. ... The segments were funny. ...
    (alt.fan.letterman)
  • Re: Prevert Dies
    ... Lots of people think like Dave does. ... Andy in Eureka, Texas ... Dave is not a fantastic prick. ... little prick who lacks the courage to promote his hateful feelings ...
    (soc.senior.issues)
  • Fri. 7/20 Big Show Synopsis
    ... Dave and Paul spend some time discussing the last time one of tonight's guests was on the Show. ... Lovitz explained why he 'beat up' Andy Dick at the Laugh Factory. ...
    (alt.fan.letterman)