Getting an error with start(vid)

1 view (last 30 days)
Stephen
Stephen on 12 Nov 2012
Using code I have used time and time again sudenly I am getting an error. I have a NI-PCIe-1430 Cameralink capture card which is supported by Image Acqusistion Toolbox. I know the Camera is working and the card is working because I can see images beign aquired when I use NI's Measurement and Automation explorer program. But using Matlab and the code below I get the following error.
ni: The serial read did not complete within the specified timeout period
for line 89 of imagdevie/start
Here is my code:
clear all close all clc
cols =640; rows =510; numframes = 1;
%% get data
disp('Get Data')
vid = videoinput('ni',1);
vid.Timeout = 10;
vid.FramesPerTrigger = numframes;
vid.ROIPosition = [0 0 cols rows];
start(vid);
data = squeeze(getdata(vid));
stop(vid);
delete(vid)

Accepted Answer

Stephen
Stephen on 13 Nov 2012
Turns out somehow the function calls needed to grab data from the NI boards has changed. I don't know if there was an update to Image acqusistion toolbox or to NI vision software but now I need the following code to get data to be captured into matlab
vid = videoinput('ni', 1, 'NICFGen_Port0');
src = getselectedsource(vid);
vid.FramesPerTrigger = 30;
start(vid);
temp = getdata(vid);
stop(vid);
delete(vid)
  1 Comment
Walter Roberson
Walter Roberson on 13 Nov 2012
I wonder if the getselectedsrc() step is needed, since nothing obvious is done with src ?

Sign in to comment.

More Answers (1)

Jan
Jan on 13 Nov 2012
What exactly does "suddenly" mean? What happend until it worked? A new operating system, Matlab version, camera driver, virus scanner, version of another software, windows update, ...? While our chance is only to guess what has changed, you have the real chance to find the difference.
Did you try to increase the timeout value?
  1 Comment
Stephen
Stephen on 13 Nov 2012
I did try the timeout increase and no help. I had replaced the NI board with a new one but again it isn't the board as I can get everything but matlab to interface to it. I finally had some success by accident because somehow I opened a Image Acqusistion Toolbox GUI and was able to get it to work and take data and it generated scripts which look diffrent then those used in previouse scripts i used to get data from the same type of NI board.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!