Increase Sample Rate with MatLab (MexFile?)

Applications, development tools, FPGA, C, WEB
Post Reply
Posts: 5
Joined: Mon Oct 14, 2019 3:26 pm

Increase Sample Rate with MatLab (MexFile?)

Post by timosmd » Thu Oct 17, 2019 12:20 pm

Hello all,

for a project I need to acquire measurement data from a current (Hall-)sensor via MatLab.

To achieve this target I chose a Stemlab 125-14 as the datasheet for the slow analog input pins states that there is the possibility for 100kS/s.

Yesterday I set up my redpitaya and tried to gather the input voltage with MatLab, altered by a Potentiometer from 0-3.3V.

The problem I encountered is that I was able to achieve a maximum of 20(!) samples per second (with the most minimalistic matlab code possible), which is far away from the sample rate I need to achieve for the project (I would need at least a few thousand kS/s).

My guess is that the query function (volts1 = str2num(query(tcpipObj,'ANALOG:PIN? AIN1'))) in the MatLab code takes too long to read enough samples during a certain time period.

I thought a solution would be to start acquisition which writes the values to a buffer (which can then be read) by using SCPI commands - but RedPitayas technical support said it's not possible with the slow analog inputs (only fast ones).

So I had the idea to read the analog value in MatLab by calling a C-Function which uses API- instead of SCPI commands and should therefore be much faster.

But I have problems creating a MEX-File in MatLab to call the necessary C-Function. Did anyone maybe already do it like this or could help me out with this?

Sorry for these questions but I already googled/researched a lot and can't find any helpful information regarding this problem.

Hope you can help me with this.


Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 1 guest