# Thread Subject: codegen - mxarray indices are not supported

 Subject: codegen - mxarray indices are not supported From: Chuck37 Date: 23 Aug, 2011 19:01:25 Message: 1 of 2 I have some pretty simple seeming code, like this: n = length(vec); ord = bitrevorder(1:n); vec = vec(ord); It just puts e vector in bit reverse order. Now I'm trying to convert to a MEX file using codegen and running into all sorts of trouble. First, of course, is that bitrevorder is not supported. But ignoring that, I keep getting errors about "mxarray indices are not supported". This seems to be preventing me from doing the most basic things. It's griping about the "vec = vec(ord)" line. I cannot believe that the coder won't support indexing into vectors, what am I missing? Even writing it out like this breaks: vec2 = vec; for k = 1:n   vec(k) = vec2(ord(k)); end There must be a way to reorder a vector according to a list of indices. Any help would be greatly appreciated!
 Subject: codegen - mxarray indices are not supported From: Chuck37 Date: 23 Aug, 2011 20:16:13 Message: 2 of 2 "Chuck37" wrote in message ... > I have some pretty simple seeming code, like this: > > n = length(vec); > ord = bitrevorder(1:n); > vec = vec(ord); > > It just puts e vector in bit reverse order. > > Now I'm trying to convert to a MEX file using codegen and running into all sorts of trouble. First, of course, is that bitrevorder is not supported. But ignoring that, I keep getting errors about "mxarray indices are not supported". This seems to be preventing me from doing the most basic things. It's griping about the "vec = vec(ord)" line. I cannot believe that the coder won't support indexing into vectors, what am I missing? > > Even writing it out like this breaks: > > vec2 = vec; > for k = 1:n > vec(k) = vec2(ord(k)); > end > > There must be a way to reorder a vector according to a list of indices. Any help would be greatly appreciated! I figured out this may have to do with the fact that I used coder.extrinsic on bitrevorder. Looks like I have to declare the output variable before the call.

## Tags for this Thread

### Add a New Tag:

Separated by commas
Ex.: root locus, bode

### What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Feed for this Thread