Re: NSData confusion
Re: NSData confusion
- Subject: Re: NSData confusion
- From: James Maxwell <email@hidden>
- Date: Fri, 20 Mar 2009 13:09:04 -0700
Ah, yes. That makes sense - you're basically finding the row as a kind
of offset in the data, is that right?
On 20-Mar-09, at 1:00 PM, Stephen J. Butler wrote:
On Fri, Mar 20, 2009 at 2:28 PM, James Maxwell
<email@hidden> wrote:
okay, but what about matrices?
I've set them up using:
float **theMatrix = [[self matrixData] mutableBytes];
and this part seems okay - or at least, it compiles... But how do I
then
access the matrix.
I've been using normal C-style array notation, thus far:
theMatrix[i][j] = 0.6666;
but this gives me an EXC_BAD_ACESS error when I run it.
Because this:
float theMatrix[ XSIZE ][ YSIZE ];
is not equivalent to this:
float **theMatrix = /* something */;
The latter says you have an array of float POINTERS. What you want
is simple:
float *theMatrix = /* something */;
And then index it with:
theMatrix[ i*XSIZE + j ] = 0.666;
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden