[Top][All Lists]

[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
    val = str2num( tbl( i ).val )
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
BioMagResBank, UW-Madison --

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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