hil_task_read_digital hil_task_read navigation bar

Table of Contents

hil_task_read_other

Deprecated

The HIL API MATLAB functions have been deprecated in favour of the new quanser.hardware.hil class, which has support for code generation for Quanser targets. Hence, with the new hil class it is possible to run MATLAB scripts in real-time on Quanser targets, while making use of the Quanser hardware.

Reads the specified number of other samples from the task's internal buffer.

Syntax

[values, samples_read, err] = hil_task_read_other(task, samples)
    

Description

Reads the specified number of other samples from the task's internal buffer. This function will block until the requested number of samples has been read or the task is stopped.

If no err output is provided then it throws an exception if an error occurs. In generated code it prints the error message. Use hil_get_error_message to get the message associated with an error code.

Parameters

task

Task handle returned by hil_task_create_other_reader or hil_task_create_other_reader_other_writer.

samples

The number of samples read. This number will be equal to the number of samples specified unless the total number of samples specified in hil_task_start has expired or the task has been stopped.

Outputs

values

A matrix of other values, as doubles. There is one row for each channel and one column for each sample.

samples_read

The number of samples read. This number will be equal to the number of samples specified unless the total number of samples specified in hil_task_start has expired or the task has been stopped.

err

A negative error code or zero on success.

Examples

% Creates a task to read other channels 0 and 3, with an internal buffer of 1000 samples.
task  = hil_task_create_other_reader(board, 1000, [0 3]);

% Start the task using SYSTEM_CLOCK_1 at 1 kHz. Collect up to 5000 samples.
hil_task_start(task, -1, 1000, 5000);

% Reads 500 samples of other channels 0 and 3. Takes 0.5 seconds to complete read.
for i=1:10
[values, n] = hil_task_read_other(task, 500);
...
end;
hil_task_stop(task);
hil_task_delete(task);
    

See Also

 

navigation bar