[Matlab] How about Global Inline function?

Status
Not open for further replies.

davyzhu

Advanced Member level 1
Joined
May 23, 2004
Messages
494
Helped
5
Reputation
10
Reaction score
2
Trophy points
1,298
Location
oriental
Activity points
4,436
matlab inline function

Hi all,

I write a inline function.
Code:
%%---------------------
function test
x=uint8(7);
y=sub_test(x)

function [y]=sub_test(x)
bitclr=inline('bitset(x,bit,0)','x','bit');
y=bitclr(x,1);
%%--------------------

But the code below seems not right:
%%---------------------
function test
bitclr=inline('bitset(x,bit,0)','x','bit');
x=uint8(7);
y=sub_test(x)

function [y]=sub_test(x)
y=bitclr(x,1);
%%--------------------

How to write global inline function that can be called by all function and sub-functions?
Thanks!

BTW, I use Matlab 5.3.
Any suggestions will be appreciated!
Best regards,
Davy
 

matlab global inline function

help global

Code:
function test
  global bitclr
  bitclr = inline('bitset(x, bit, 0)', 'x', 'bit');
  x = uint8(7);
  y = sub_test(x)

function y = sub_test(x)
  global bitclr
  y = bitclr(x, 1);
Happy MATLABing!
 

    davyzhu

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…