This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 1 MATLAB Function Calls for the LabJack U12 Contained within Matlab_funcs.zip are all of the necessary files to communicate with the LabJack U12 within the MATLAB environment. Due to the nature in which MATLAB communicates with the LabJack drivers, some extra time is required to make function calls. For single function calls the execution time is increased form 20 milliseconds to approximately 50 milliseconds. However, if the function calls are made repeatedly within a loop, the execution time decreases to values of 20 milliseconds or less. Multiple function calls in succession allows MATLAB to keep the necessary files in memory, decreasing total execution time. If knowing function execution time is critical, it is suggested that the user make use of MATLAB functions to calculate the execution time. See MATLAB documentation for more information on this topic. The LabJack functions were all compiled using MATLAB version 6.1. Use of these functions with older versions of MATLAB may not be possible. If difficulties arise when using these functions, please contact LabJack ( mailto:[email protected] ). 1.1 Getting Started To use the LabJack functions for MATLAB, start by extracting the files in Matlab_funcs.zip to a folder located somewhere on your hard drive. Open up MATLAB, choose File from the menu bar, and select Set Path from the list of options. A window will open that allows the user to set the path of the file containing the LabJack function calls. In the Set Path window press the Add Folder button and locate the folder containing the LabJack files. Once the file has been selected press OK . The directory path of the LabJack function folder should now appear at the top of the list in the MATLAB search path. If it is present press the Save button. The MATLAB search path has now been modified to include the file containing all the LabJack functions. Close the Set Path window by pressing the Close button. Note : Any time a function is called, MATLAB must locate its source code. In the case of the LabJack functions, MATLAB must locate the compiled *.dll files used for communication with the LabJack drivers. At the time of a function call, MATLAB will always start looking for the required files in the current working directory. From there it moves on to all of the files listed in the MATLAB search path. If the LabJack folder is moved, the search path has to be modified to reflect its new location. Otherwise MATLAB will be unable to locate the required files. 1.2 Using the LabJack Functions Calling the LabJack functions within MATLAB is done just as any standard MATLAB function. Each function has a set of input arguments and return values. The general calling syntax for the MATLAB functions is [Output Values] = Function_name(Input Arguments) The first term, [Output Values], represents an array of variables that MATLAB will set equal to the returned values of the function. Each function has a different number of return values. The number of elements in the return variable array can be any number up to the total number of...
View
Full Document
 Spring '08
 Reinkensmeyer,D
 matlab, Labjack, local id

Click to edit the document details