Go Down

Topic: Problem on matlab interfacing (Read 234 times) previous topic - next topic

soumen

When I want to interface Arduino with matlab and I am writing the code in Matlab' a=arduino('COM15'); the error message showing "Undefined function 'arduino' for input arguments of type 'char'.". Kindly help me .

spycatcher2k

Please refer to the matlab forum, it's covered in great length there.
Drew.
http://www.uk-pcb.co.uk - My UK Based PCB Fab & Assembly Company
Design work undertaken
SMD & Thru-Hole assembly

soumen


Please refer to the matlab forum, it's covered in great length there.

I could not find the solution. Kindly help me

tom4444

My MATLAB is not able to use that function either. A solution is to use serial:

Code: [Select]
a=serial('COM15'); % Start up serial port.

It reads out the COM port you defined, which means that you can read out any serial information. You can use "set" to change the properties of your serial data transfer:

Code: [Select]
set(a,'Baudrate',9600); % Set BaudRate to 9600.

Then you have to open the serial connection, using fopen:

Code: [Select]
fopen(a);

You can use all functions like scanf and printf to read and write over the serial connection, and finally, you have to close the serial connection using fclose:

Code: [Select]
fclose(a);

Do not forget to use fclose, else you cannot use that serial port by any other application unless you restart MATLAB.

spycatcher2k

https://www.youtube.com/watch?v=RAkw-lnaZR0   <-- found on GOOGLE
Drew.
http://www.uk-pcb.co.uk - My UK Based PCB Fab & Assembly Company
Design work undertaken
SMD & Thru-Hole assembly

Go Up