getinput - Specified input argument object from function object

Syntax

inputobj = getinput(ff,input_name)

Description

inputobj = getinput(ff,input_name) returns the input object that accesses input_name. Enter input_name in single quotation marks because it is a string.

Examples

Use getinput to see the properties of an input object in a function object:

sin_t=createobj(cc,'sin_taylor')

FUNCTION Object
  Function name     : sin_taylor
  File found        : hiltut.c
  Start address     : [12328 0]
  All variables     : a1, a2, a3, acc, x, xpow
  Input variables   : x
  Return type       : short

sin_t.inputvars

ans = 

    x: [1x1 ccs.rnumeric]

x_inobj=getinput(sin_t,'x')

NUMERIC Object stored in register(s): 
  Symbol name              : x
  Register                 : A4
  Datatype                 : Unknown
  Wordsize                 : 16 bits
  Register units per value : 1 ru
  Representation           : signed
  Bit padding (post)       : 16
  Size                     : [ 1 ]
  Total register units     : 1 ru
  Array ordering           : row-major

x_inobj

NUMERIC Object stored in register(s): 
  Symbol name              : x
  Register                 : A4
  Datatype                 : Unknown
  Wordsize                 : 16 bits
  Register units per value : 1 ru
  Representation           : signed
  Bit padding (post)       : 16
  Size                     : [ 1 ]
  Total register units     : 1 ru
  Array ordering           : row-major

Demonstrate that the information from getinput may change after executing a function.

In your CCS project:

 void fl2q15(double *x, short *r,int nx); % r is where the output 
                                          % is stored

In the MATLAB® command window, here is the code that demonstrates getinput changing.

% Create function class

cc = ccdsp;
ff = createobj(cc,'fl2q15')

% Create objects that will be used as inputs to fl2q15

input_x = createobj(cc,'input_x')  % Global variable--an array of 
                                   % doubles
write(input_x,[0.1 2.5 8.0]) % Write data into input_x

input_r = createobj(cc,'input_r')  % Global variable--an array of 
                                   % shorts

% Get input objects and assign values

xobj = getinput(ff,'x')
write(xobj,input_x.address)

robj = getinput(ff,'r')
write(robj,input_r.address) % Also means 'set the result to point 
                            % to the location of input_r'

nxobj = getinput(ff,'nx')
write(nxobj,3)

% Run the function

run(ff)

% Read the result

output_err = read( deref( robj ) )  % Returns the wrong result 
                                    % because robj now holds a 
                                    % different value

output_correct = read( input_r ) ) 

Gives the correct result because the address of input_r did not change.

See Also

createobj, getoutput

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS
 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS