I'm trying to get started with Python for Labjack. I have not used Python before (or have only very little), but I am familiar with Matlab and would like to use Python in a similar way as I have Matlab. Now I am using a UE9 with MacOSx. Previously I have used (and really liked using) a U12 with Matlab.

For Matlab, I have on my hard-drive a library of files (not sure if that was provided by Jabjack or whom) that made it very easy to get going. Particularly, there is a PDF called "MATLAB Function Calls.pdf" that has a good definition of the function calls and examples of them in use (I've attached that file here). Is there a similar document for Python?

Are there examples of the use of python with a UE9 for doing something simple. Here's the first script I put together in Matlab (analog_sample(), below), starting with something I think I picked up in the aforementioned file. This is the type of script I'd like to get running in Python now, to get going. Help "translating" this to Python would be appreciated.

%*******************************************************************

function data = analog_sample()

%I modified the original example file.

%this records the approximate real time data was taken, not just desired.

%feb2008cme

clc;

timestep=0.20; %200msec seems about as good as I can do with this program.

numsteps=100;

tic

for (i = 1:numsteps);

start = cputime;

time = toc; %(i-1)*timestep;

% real_time=toc;

% if abs(real_time - time)>timestep

% disp(['Real Time is ',num2str(real_time),', Expected Time is ',num2str(time),' seconds']);

% % error('Use a larger timestep - not keeping up.');

% end

volts = EAnalogIn(-1,0,1,0); % Sample analog signal using AI1

data(i,:) = [time volts]; % Data array for plotting

elapsed = start-cputime; % Calculate the time elapsed during funciton call

if (i==1);

fig1=figure;

plot(time,volts,'o');

xlim([0 2*numsteps*timestep]);

hold

end

plot(time,volts,'o');

pause(timestep-elapsed); % Pause for remainder of timestep

end

toc

disp(['meant to have ',num2str(numsteps*timestep),' seconds']);

for i=1:size(data,1)-1 dt(i,1)=data(i+1,1); dt(i,2)=data(i+1,1)-data(i,1); end

% Plot data

if exist('fig1') close(fig1); end

figure

subplot(2,1,1)

plot(data(:,1),data(:,2),'-or');

title('Analog Input Channel 1');

xlabel('Time (s)');

ylabel('AI1 Input (V)');

grid on;

subplot(2,1,2)

plot(dt(:,1),dt(:,2),'b',dt(:,1),dt(:,2)*0+timestep,'r');

%*******************************************************************

Best Regards.