Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Logical indexing is not yet supported in Matlab Embedded??

Subject: Logical indexing is not yet supported in Matlab Embedded??

From: ASL Bravo

Date: 27 Feb, 2010 01:21:03

Message: 1 of 5

Hi,
I am writing a simple prog to get rid of <0 elements of array, see below
a = [u1, u2, u3, u4];
b = a(:)>= 0;
c = a(b);

however matlab embedded doesnt allow dynamic indexing, any help to get around this?? have to generate code and implement on a real time device. thanks

Subject: Logical indexing is not yet supported in Matlab Embedded??

From: TideMan

Date: 27 Feb, 2010 03:39:55

Message: 2 of 5

On Feb 27, 2:21 pm, "ASL Bravo" <engr...@live.co.uk> wrote:
> Hi,
> I am writing a simple prog to get rid of <0 elements of array, see below
> a = [u1, u2, u3, u4];
> b = a(:)>= 0;
> c = a(b);
>
> however matlab embedded doesnt allow dynamic indexing, any help to get around this??  have to generate code and implement on a real time device. thanks

c=a(a>=0);

Subject: Logical indexing is not yet supported in Matlab Embedded??

From: ASL Bravo

Date: 27 Feb, 2010 11:25:07

Message: 3 of 5

TideMan <mulgor@gmail.com> wrote in message <0eea2f66-3f18-441d-b4c2-6e7eca023552@b9g2000pri.googlegroups.com>...
> On Feb 27, 2:21 pm, "ASL Bravo" <engr...@live.co.uk> wrote:
> > Hi,
> > I am writing a simple prog to get rid of <0 elements of array, see below
> > a = [u1, u2, u3, u4];
> > b = a(:)>= 0;
> > c = a(b);
> >
> > however matlab embedded doesnt allow dynamic indexing, any help to get around this??  have to generate code and implement on a real time device. thanks
>
> c=a(a>=0);

Reply>> same error again EML does not support logical indexing. Need help!

Subject: Logical indexing is not yet supported in Matlab Embedded??

From: Steven Lord

Date: 1 Mar, 2010 05:27:21

Message: 4 of 5


"ASL Bravo" <engr_uk@live.co.uk> wrote in message
news:hm9s1v$6gl$1@fred.mathworks.com...
> Hi,
> I am writing a simple prog to get rid of <0 elements of array, see below a
> = [u1, u2, u3, u4];
> b = a(:)>= 0;
> c = a(b);
>
> however matlab embedded doesnt allow dynamic indexing, any help to get
> around this?? have to generate code and implement on a real time device.
> thanks

There's no way to tell, just from looking at this code, what size and shape
c will be as a function of just the sizes of the inputs, and I believe
that's (more or less) one of the requirements for an Embedded MATLAB
function. So no, I don't think there's going to be any way to "get around
this". If you were to _replace_ the negative elements of a with some other
value (say 0) but maintain its size, I believe that may work. But that
would likely require changes to your code further down the line.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ

Subject: Logical indexing is not yet supported in Matlab Embedded??

From: ASL Bravo

Date: 1 Mar, 2010 11:18:04

Message: 5 of 5


Hi, The array c will be (1x4) if none of elements of array "a" is less than zero, but again its dynamic and 'a' may change. Negative numbers are basically illegal/error values which I need to discard before take averge of >=0 elements.

Is it possible to define local variable of type array and do a for loop to the original array 'a'. All elements >=0 can be stored in new array 'c'.

When I try to define array 'c', eml return commad-duality not supported

Help please...

Tags for this Thread

No tags are associated with this thread.

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.

Contact us