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: undefined function or variable
Replies: 2   Last Post: Sep 17, 2013 10:31 AM

Advanced Search

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

Posts: 17,944
Registered: 12/7/04
Re: undefined function or variable
Posted: Sep 17, 2013 10:31 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply



"JIAWEI " <jiaweihe.zju@gmail.com> wrote in message
news:l18bco$3bd$1@newscl01ah.mathworks.com...
> Dear all,
> I am new to matlab and got stuck with a problem---- undefined function or
> variable b.
> could any of you help me with it? thank you very much.
>
> my function is as follows;
> function [ p ] = RT( a )
> %UNTITLED2 1-dimension rapid transformation
> % Detailed explanation goes here
>
> [m,n]=size(a);
>
> if n~=1
> for i=1:n/2
> b(i) = a(i) | a(i+n/2);


Assuming n is even, you could do this by converting a into a column vector,
reshaping that to have 2 columns and half as many rows, and ORing the two
columns. [You'd then want to make sure that b's orientation, row vector or
column vector, is what you want it to be.]

> c(i) = xor(a(i),~a(i+n/2));

Ditto but with XOR and NOT.

> end
> b=RT(b); c=RT(c);
> end
> p = [b,c];


If n is equal to 1 (i.e. you pass in a scalar or a column vector as a) then
your FOR loop never executes and neither b nor c are defined before this
line executes.

> end
>
> I have a feeling that the problem may be that b=RT(b) is not correct,but I
> am not sure and have no idea how to fix it. thank you again!


That's okay, if recursive.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com




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.