You are here

Transferring data to Matlab | Cypress Semiconductor

Transferring data to Matlab

Summary: 5 Replies, Latest post by danaaknight on 04 Oct 2012 02:55 PM PDT
Verified Answers: 0
Last post
Log in to post new comments.
user_183705841's picture
22 posts


I need to transfer a matrix (of numbers) from the PSoC to Matlab using serial port and to be able to save it in a .mat file later.

Also, I need to disply them on real time as a graph, but I can only use 115200 baudrarte.

Someone maybe tried something like this and can help me?


user_189995688's picture
138 posts

 In PSoC Creator there is the UART component.

You can use this to transmit data via a serial port. A minimum connection needs only 2 Wires - TX and GND, and if you need data to go back into the PSoC then you'll need RX too. (TX = Transmit, RX = Receive).

In terms of hardware you'd need to add a signal convertor chip such as the MAX232 in order to convert the CMOS level signals from the PSoC to th +/- 12V signals of RS232

Read the data sheet for the UART component in Creator for implementation details.

Post back here with how you get on and if you need any more help or information.

user_183705841's picture
22 posts

Hi SpiderKenny,

Thanks but I don't need help regarding the serial interface implementation.

I'm trying to transfer the numbers into Matlab using the serial interface I already using in the PSoC5, 

and the problem is that the Matlab program can't read the data from the serial port, do some math and to display it on a graph in

realtime. I've tried to add a delay for each transfer and it's not working (and I'm really trying to avoid this kind of methods). 

I'm searching for a solution regarding transfering the data fast and safetly (like handshaking) to the Matlab not in the convetional

way of transfering the numbers in characters becuase it just don't work for me.

I thought maybe somehow to encrypt the numbers and to decrypt them back in Matlab. 

user_189995688's picture
138 posts

 Ah right - I see now.

Well, there are various mechanisms for pacing the serial data.

It depends on the size of the receive buffer in matlab, and whether matlab supports handshaking. 

Can I assume you only have  a 3-wire serial interface? So Hardware handshaking is out of the question?

In that case you could use software handshaking, of your design, where matlab sends a 'ready' signal and you transfer a small amount and wait for the next 'ready' - or you could implement your own XON-XOFF handshaking.

Can you describe the problem you are seeing in matlab? Are parts of the data missing? Have you tried asking in any matlab forums?

user_460349's picture
1362 posts

 How about having psoc sending ascii value with "." or ";" as delimiter. With the matlab prasing the data and store it in an array for display purpose. This way, you can also use a special pattern like AA;55; from the psoc to signal a restart of the readings

user_14586677's picture
7646 posts

You might start with a basic calculation of how many MIPS you need.

If complex math is being done by Matlab, likle an FFT on the data, Matlab

must have a spec on its algorithim in terms of time to complete, eg input

sample rate.


By your description seems like you are trying to effect a DSO, which generally

use hi speed DSP and FPGA to keep up with the data signal processing.

Screen refresh rate one consideration.


Regards, Dana.

Log in to post new comments.