[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: equivalent for C-style init: structname varname[] = {...} ?
From: |
Dimitri Maziuk |
Subject: |
Re: equivalent for C-style init: structname varname[] = {...} ? |
Date: |
Mon, 19 Nov 2012 11:58:00 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.10) Gecko/20121030 Thunderbird/10.0.10 |
On 11/19/2012 11:45 AM, Jordi Gutiérrez Hermoso wrote:
> You didn't give me enough context to debug this, and I suspect you
> could be incorrect about the line in which this problem occurs, or you
> could be looking at the wrong iteration of this loop. The error about
> A(I) = X is completely unrelated to structs. My suspicion is that for
> some i in tbl, it happens that i.val isn't a scalar, so you're
> attempting to assign a vector or matrix to a single entry in the row
> vector.
Oh please. Try it on a matlab user, they might believe you. Replacing
that with
...
if( isnumeric( tbl( i ).val ) )
val = tbl( i ).val
else
val = str2num( tbl( i ).val )
endif
row( 5 ) = i.val;
...
makes it work just fine so it's rather clear which part is interpreted
as what type. Just like in my earlier question sscanf interpreted "HE"
as ascii codes for 'H' and 'E' (despite being given a "%s" *and* saying
it read them as one value).
I wish I could rewrite this piece of matlab expletive deleted in
numpy/python instead of trying to get it to run in octave...
--
Dimitri Maziuk
Programmer/sysadmin
BioMagResBank, UW-Madison -- http://www.bmrb.wisc.edu
signature.asc
Description: OpenPGP digital signature
- Re: equivalent for C-style init: structname varname[] = {...} ?, (continued)
- Re: equivalent for C-style init: structname varname[] = {...} ?, Sergei Steshenko, 2012/11/19
- Re: equivalent for C-style init: structname varname[] = {...} ?, Sergei Steshenko, 2012/11/18
- Re: equivalent for C-style init: structname varname[] = {...} ?, Dimitri Maziuk, 2012/11/19
- Re: equivalent for C-style init: structname varname[] = {...} ?, Jordi Gutiérrez Hermoso, 2012/11/19
- Re: equivalent for C-style init: structname varname[] = {...} ?, Jordi Gutiérrez Hermoso, 2012/11/19
- Re: equivalent for C-style init: structname varname[] = {...} ?, Dimitri Maziuk, 2012/11/19
- Re: equivalent for C-style init: structname varname[] = {...} ?, Jordi Gutiérrez Hermoso, 2012/11/19
- Re: equivalent for C-style init: structname varname[] = {...} ?,
Dimitri Maziuk <=
- Re: equivalent for C-style init: structname varname[] = {...} ?, Dimitri Maziuk, 2012/11/19
- Re: equivalent for C-style init: structname varname[] = {...} ?, Jordi Gutiérrez Hermoso, 2012/11/19
- Re: equivalent for C-style init: structname varname[] = {...} ?, Judd Storrs, 2012/11/19
- Re: equivalent for C-style init: structname varname[] = {...} ?, Francesco Potortì, 2012/11/20
- Re: equivalent for C-style init: structname varname[] = {...} ?, Dimitri Maziuk, 2012/11/20
- Re: equivalent for C-style init: structname varname[] = {...} ?, Francesco Potortì, 2012/11/20
- Re: equivalent for C-style init: structname varname[] = {...} ?, Jordi Gutiérrez Hermoso, 2012/11/20
- Re: equivalent for C-style init: structname varname[] = {...} ?, Judd Storrs, 2012/11/20
- Re: equivalent for C-style init: structname varname[] = {...} ?, Michael Goffioul, 2012/11/20
- Re: equivalent for C-style init: structname varname[] = {...} ?, Sergei Steshenko, 2012/11/20