Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top