help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Create Structure


From: Thomas D. Dean
Subject: Create Structure
Date: Sat, 11 Jun 2016 23:51:28 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0

I have a character array with 156 names and a corresponding array of values;

octave:341> a=["n1";"n2";"n3"]
octave:342> b=[1;2;3]
octave:343> x=struct(a(1,1:2),b(1),a(2,1:2),b(2),a(3,1:2),b(3))
octave:344> x
x =

  scalar structure containing the fields:

    n1 =  1
    n2 =  2
    n3 =  3

Is there a function to do this?  Do I have to go to an oct file?

I have looked at cellfun, and structfun, but, could not make either work. Most likely, I do not understand this...

Tom Dean



reply via email to

[Prev in Thread] Current Thread [Next in Thread]