Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

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 ]
kinor

Posts: 181
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$1@newscl01ah.mathworks.com>...
> "kinor" wrote in message <kjmptu$20a$1@newscl01ah.mathworks.com>...
>

> > 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

ts=tic;
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;
toc(ts)

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]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.