XBee-MATLAB pt.2

Hello again!

I got a thing to (kind of) work! Here’s the slightly modified loop:

while(1)
 while(s.BytesAvailable==0)
 end
r = fscanf(s);
if (r == 'hi')
fprintf(s, 'hello!');
end
 s.BytesAvailable
end

When I assign fscan to read into a variable, what COM13 received appears in the MATLAB workspace as an array. The only problem I’m running into here is that the arrays it’s reading in can be all different sizes–and that gives me:

Error using == 
Matrix dimensions must agree.

So from here, the next steps would be:

  1. adding a start/end character, or otherwise limiting array sizes
  2. hooking the COM13 XBee back up to the Arduino, and then
  3. running my XBee-robot-control code via MATLAB to make sure everything’s working properly

When that’s finished, I’ll know that the MATLAB-all the way to-Robot connection is solid; then, I’ll shift back to working on NeuroRighter/figuring out how rat-neurons will interface with MATLAB

Leave a Reply

Your email address will not be published. Required fields are marked *

CAPTCHA

*