Hi,
i have an arduino program reading a rotary encoder.
i open arduino on matlab using serial, and id like matlab to read variables value from arduino but not sure how to access them.
something like "serial.read" or global variable..
id like matlab to read variables value from arduino
And pigs would like wings. That isn't going to happen.
Matlab can send messages to the Arduino. The Arduino can read the message, and respond appropriately. That might include sending the contents of a variable to Matlab. But, Matlab is not going to get direct access to anything on the Arduino.
The first thing i did was writing a code on matlab, and it worked good, but far to slow.
so i realized i have to let arduino read the pins, because its much faster. so now the arduino is reading pins and counting the movement of the rotary encoder, and it really works great.
the only thing is, im looking for a way to pick up a value from the arduino and output it in Matlab.
Galya:
im looking for a way to pick up a value from the arduino and output it in Matlab.
First - have you used Google to find any of the other Arduino Forum Threads about Matlab?
I would be very surprised if you do not find an answer that way.
Second, if you still need help you need to post the code you have tried - even if it does not work very well.
%HERE I'D LIKE TO HAVE SOMETHING LIKE "disp(Serial.println(positionLeft))"
Feel free. It looks pointless.
The Arduino will use Serial.println() to send data to Matlab. Matlab will NOT use Serial.println(). Matlab will use its own method/function to read from the serial port.
the problem is accessing the values of the variables- like "positionLeft" that is on the arduino code.
No. It seems to me that the problem is that you don't have a clue how to read serial data in Matlab. Asking how to do that on a Matlab forum is going to be far more effective than to keep asking here. They don't know anything about Arduino. We don't do Matlab.
Not sure what your problem is, if you don't know how to help you can save your cheerfulness to yourself.
last i checked the purpose of the forum is to get advice and answer to questions not defeat-full attitude