Show Posts
Pages: [1]
1  Using Arduino / Interfacing w/ Software on the Computer / Re: new column of data in Serial Monitor on: January 15, 2013, 04:43:33 am
as I know, arduino writes results as "string", so I wrote this code in Matlab:
Code:
data=fscanf( s, '%s',3 )
y(i)=str2double(data)
plot(i,y(i));

drawnow;
hold on
ok, it gives me something, but it is not correct... :/

and another question: How can I connect dots in "real time" graph in Matlab? I have discrete measurments, and it plot me only seperated points...
2  Using Arduino / Interfacing w/ Software on the Computer / Re: new column of data in Serial Monitor on: January 15, 2013, 04:22:11 am
I tried, but it doesn't work...it doesn't read third column...  smiley-sad
3  Using Arduino / Interfacing w/ Software on the Computer / Re: new column of data in Serial Monitor on: January 14, 2013, 06:46:55 pm
Hello,

this is one part of arduino code
Code:
Serial.print("\t");
  Serial.print(freq(), DEC);
  Serial.print("\t");
  Serial.print("");   
  Serial.print(osvet(), DEC);
  Serial.println("\t");

it gives me this results on Serial Monitor (where the left column is counter), and the other two columns are other data
Code:
1 800 86956
2 800 86956
3 790 85869
4 790 85869
5 780 84782
6 780 84782
7 780 84782
8 780 84782
9 780 84782
10 790 85869


Ok, now I want to read this in Matlab
Code:
s = serial('COM4', 'BaudRate', 9600);
fopen(s);

for i= 1:2000

data=fscanf(s);
y(i)=str2double(data);
plot(i,y(i));
drawnow;
hold on
end
fclose(s);

but I want to plot third column (y), and first coulmn (x)...
actually I want to do that:
Code:
.
.
.
plot(data(:,1),data(:,3);
drawnow;
.
.
.


so, is it possible, and how?

thank you for your help!!!
4  Using Arduino / Interfacing w/ Software on the Computer / new column of data in Serial Monitor on: January 13, 2013, 04:57:12 am
hello,

in arduino serial monitor, I acquire three columns of different data seperated with tab "Serial.print("\t");  "
If I read that data in Matlab, it doesn't recognise those data as three columns, but one.

is there any "Serial.print("???")" that helps to write each data in next column, that Matlab will be able to recognise it as next column?

thanks
Pages: [1]