LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

matlab speed optimization

Hi Ruz,

Attached is a zip file with the .mex functions in it.  Included are comments on how to call the functions.

Regards,

Message Edited by Maclean on 08-29-2007 10:09 PM

Maclean G.
Applications Engineering
National Instruments
0 Kudos
Message 11 of 15
(1,286 Views)

Hi Maclean,

  Thanks for compiling the files to mex for me. I am having trouble though. I created the following program in matlab.

[Image_Parameters_:_Image_Type] = begin_image_acquisition

for i = 1:2

    [Acquired_Buffer_Number, Image_Pixels_(U8)] = acquire_image_array(Image_Type)
   
    image(Image_Pixels_(U8) )
end

stop_acquire;

I am getting the following error :

Error: File: c:\mfiles\mex\progA.m Line: 3 Column: 20
Missing variable or function.

I think something is wrong with the begin_image_acquisition function.  Any thoughts? Maybe the underscores in the [Image_Parameters_:_Image_Type] output variable are screwing things up?  I also noticed a couple things that puzzled me. The imaq session and error parameter are not being passed out of begin_image_acquistition function, but the acquire_image_array function needs them (at least in labview it does).

Thanks,

Ruz

0 Kudos
Message 12 of 15
(1,269 Views)

Hi again Maclean,

As a follow up. I noticed that having a colon in the output argument is confusing matlab when I call the mex file. However, when I change the syntax I still get an error. For example... at the cmd prompt I typed in

>> [test] = begin_image_acquisition
??? One or more output arguments not assigned during call to 'begin_image_acquisition'.

I think the colon in the output name in labview is screwing up the conversion to the mex function and the output variable is not getting passed to matlab correctly. I found the following on the mathworks web site. See below.

Section 43: One or More Output Arguments Not Assigned During Call to ‹Function›

For Versions of MATLAB up to MATLAB 6.1 (R12.1):
 
Warning: One or more output arguments not assigned
during call to ‹function›.

For MATLAB 6.5 (R13):
 
??? One or more output arguments not assigned
during call to ‹function›.

Explanation:
One of the functions you have called is defined to return an output argument but that output argument does not exist in that function when it tries to return.

Common causes:
You have misspelled the name of one of your output arguments inside your function, or you have forgotten to assign a value to one of the output arguments of your function. Alternatively, the function was originally written with one or more output arguments, but the section of the function that computed the output argument was removed or modified in such a way that the output argument is now extraneous.

0 Kudos
Message 13 of 15
(1,270 Views)
Hi Ruz,

The problem is that you don't have the Math Interface Toolkit installed. You have to have the toolkit to interface with LabVIEW when the mex function is called. I am sorry I didn't check this before. You should contact your local sales rep about possibly getting a trial of the toolkit.

Regards,
Maclean G.
Applications Engineering
National Instruments
0 Kudos
Message 14 of 15
(1,264 Views)

Ahh. Okay. I will see if I can do that.

I appreciate your help.

-Ruz

0 Kudos
Message 15 of 15
(1,259 Views)