I’m transferring data from arduino to matlab, and to know what sensor and what axis the data is from I’m using letters to identify each position.
SerialBT.print("a");
SerialBT.print(accel_ang_x);
SerialBT.print(",");
delay(500);
SerialBT.print("b");
SerialBT.print(accel_ang_y);
delay(500);
SerialBT.print(",");
SerialBT.print("c");
SerialBT.print(accel_ang_z);
delay(500);
SerialBT.print(",");
(The data readings are split with commas in matlab)
When I read said data in matlab it usually doesn’t begin in the order I have set it to in arduino as it “catches” up to the sensor transmission at a different point than when the data starts to be read. so I figured that I could use letters to see if the order is correct.
This is the code I have tried in order to categorize it, but it gives me errors.
for i=1:100
if startsWith(a(i),"a")==true
a(i)=erase(a(i),"a");
a(i)=str2double(a(i));
data(:,1)=a(i);
end
end
Is there an easier way to do this? or are there errors in my code?
Thank you in advance
heheh heheheh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.