The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: speeding up assigning values to a matrix
Replies: 7   Last Post: Apr 8, 2013 3:52 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 185
Registered: 11/19/09
Re: speeding up assigning values to a matrix
Posted: Apr 5, 2013 12:06 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Luca " <l.presottoRE@MOVE.campus.unimib.NOTit> wrote in message <kjmqpp$4r7$>...
> "kinor" wrote in message <kjmptu$20a$>...

> > Hi Luca,
> > i guess your mask(:,:,:,3) = (mask>4 &mask<7)*255;
> > should be maskC(:,:,:,3) = (mask>4 &mask<7)*255; ?

> Yes, of course!
> I'm going to try how faster your version is.
> I would not expect reducing the number of scalar multiplications to provide great improvements.
> You don't see either a way to use logical indexing, do you?

there is a way which is slower than

maskC(:,:,:,1) = (mask==uint8(2));
% toc(ts);
% ts=tic;
maskC(:,:,:,2) = (mask==uint8(4));
% toc(ts);
% ts=tic;
maskC(:,:,:,3) = (mask==uint8(6));
% toc(ts);
% tic
maskC = maskC*255;

still wonder how much time is needed on your system...

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.