LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Matlab script interface

Ok I have a question and two suggestions...

Question: How do you pass data from labview to a varargin (cell array)
parameter in a matlab script? Everytime I attempt Labview crashes so
apparantly I'm doing it wrong.

Suggestion #1: In my experience so far, I get TONS of fpsane errors if I am
not careful about handling real/complex numbers, vectors, and matrixes
correctly with a matlab script node under LV 6.1. The auto conversion seems
to work but soon after I'll get an fpsane error. So if you get these double
check your datatypes and any forced conversions.....

Suggestion #2: If you want to pass a string to labview. Convert to a byte
array, pass it in as a real vector, then use char(x) in your matlab script
node to change back to a string.

-joe
y
0 Kudos
Message 1 of 3
(2,696 Views)
LabVIEW only supports the input and output of certain kinds of data strutures to a MatLAB script node. I do not know what a varagin is. If you are having problems passing a numeric array, I have attached a simple LV VI that inputs a numeric array to a script node and outputs to a numeric array.

Jeremy
0 Kudos
Message 2 of 3
(2,696 Views)
Varargin is the most convenient method for matlab programmers to support
additional parameters in a function. Type "help varargin" at the matlab
prompt for more information.

I still haven't been able to resolve the problem yet... Any matlab
programmers have advice? I can't figure out what a cell array should look
like to Labview. I'm sure theres SOME way to create this!

VARARGIN Variable length input argument list.
Allows any number of arguments to a function. The variable
VARARGIN is a cell array containing the optional arguments to the
function. VARARGIN must be declared as the last input argument
and collects all the inputs from that point onwards. In the
declaration, VARARGIN must be lowercase (i.e., varargin).

For examp
le, the function,

function myplot(x,varargin)
plot(x,varargin{:})

collects all the inputs starting with the second input into the
variable "varargin". MYPLOT uses the comma-separated list syntax
varargin{:} to pass the optional parameters to plot. The call,

myplot(sin(0:.1:1),'color',[.5 .7 .3],'linestyle',':')

results in varargin being a 1-by-4 cell array containing the
values 'color', [.5 .7 .3], 'linestyle', and ':'.

See also VARARGOUT, NARGIN, NARGOUT, INPUTNAME, FUNCTION, LISTS.

"Jeremy Braden" wrote in message
news:506500000005000000FF8F0000-1027480788000@exchange.ni.com...
> LabVIEW only supports the input and output of certain kinds of data
> strutures to a MatLAB script node. I do not know what a varagin is.
> If you are having problems passing a numeric array, I have attached a
> simple LV VI that inputs a numeric array to a script node and outputs
> to a numeric array.
>
> Jeremy
0 Kudos
Message 3 of 3
(2,696 Views)