Values in Matlab export

Forum for discussing PicoScope version 6 (non-automotive version)
Post Reply
chris_bore
Newbie
Posts: 0
Joined: Thu Dec 08, 2011 2:28 pm

Values in Matlab export

Post by chris_bore »

When saving data as Matlab files, what is the maximum genuine value (values seem to saturate at +/-Inf and to be saved as doubles).

Hitesh

Re: Values in Matlab export

Post by Hitesh »

Hi Chris,

Which PicoScope device are you using?

The values returned by the driver will be 16-bit integers - when loaded into the MATLAB, these values will be converted into the default double data type.

As these are 16-bit ADC count values, the max/min values in ADC counts should be +/- 32767. Depending on the voltage range used, these values will be scaled accordingly to convert into milliVolts. The following code snippet from the 3000A series C example should demonstrate this:

Code: Select all

int adc_to_mv(long raw, int ch, UNIT * unit)
{
        if(scaleVoltages == 1)
        {
	      return (raw * inputRanges[ch]) / unit->maxValue;
        }
        else
        {
             return raw;
        }
}
In the function arguments, raw is the raw ADC value, ch is the index used to determine the voltage range used, and unit is a structure used to hold information about the device.

There is a function call that returns the maximum value for a device, in ADC counts, for a device in the 3000A series API. For the PicoScope 3204B, this is 32512. Anything above this is likely to be returned as invalid number - it may be that MATLAB treats these as an infinite number.

If you have an example file you could send to support@picotech.com, we can take a look.

Regards,

Post Reply