How can I store I and Q data from the serial port to the table with separate column?
17 views (last 30 days)
Show older comments
This is my coding, this coding will read my serial port.
close all; clear all;
%i = 1;
t=2;
a=0;
% serial object
% serial object
s = serial('COM4','BaudRate',9600);
% open serial port
fopen(s);
fprintf(s,'%s','OR')
while(t)
a =fscanf(s,'%s')
t=t+1;
end
fclose(s)
After i run it, the command window will show the output like this. How can i store the I and Q data from serial to the table with separate column?
a =
'{"SpeedOutputFeature":"R"}'
a =
'{"I":[2057,2053,2049,2041,2063,2039,2039,2053,2037,2035,2041,2041,2051,2057,2055,2057,2065,2035,2033,2059,2053,2039,2067,2049,2051,2029,2053,2063,2075,2035,2071,2037,2061,2033,2069,2043,2037,2037,2015,2061,2055,2059,2031,2063,2037,2063,2043,2063,2053,2049,2043,2053,2035,2067,2031,2023,2031,2041,2053,2049,2029,2051,2065,2037,2075,2037,2041,2063,2031,2069,2063,2041,2049,2043,2055,2075,2049,2061,2073,2055,2059,2049,2011,2041,2037,2027,2035,2037,2065,2057,2033,2071,2029,2065,2055,2037,2057,2057,2055,2055,2065,2'
a =
'039,2055,2025,2067,2051,2063,2043,2049,2033,2011,2031,2063,2049,2035,2057,2035,2055,2027,2059,2035,2031,2055,2053,2051,2063,2031,2049,2033,2051,2051,2025,2039,2031,2059,2021,2063,2053,2079,2041,2055,2067,2051,2049,2027,2063,2069,2049,2043,2019,2029,2049,2055,2009,2063,2061,2055,2049,2051,2031,2005,2039,2049,2057,2041,2061,2049,2053,2063,2043,2051,2079,2023,2063,2059,2053,2051,2053,2051,2027,2033,2049,2071,2029,2051,2005,2039,2043,2063,2049,2035,2055,2055,2049,2053,2059,2019,2063,2031,2055,2065,2029,2067,206'
a = '7,2067,2049,2043,2059,2019,2063,2053,2049,2041,2029,2051,2033,2051,2071,2055,2037,2039,2037,2057,2035,2039,2031,2041,2033,2051,2019,2043,2031,2037,2069,2043,2037,2043,2029,2043,2055,2035,2043,2057,2067,2037,2067,2023,2037,2035,2037,2041,2041,2025,2067,2039,2059,2035,2021,2037,2049,2071,2059,2069,2049,2033,2035,2035,2039,2067,2039,2063,2027,2051,2057,2057,2043,2041,2003,2031,2061,2027,2029,2051,2053,2037,2067,2039,2063,2041,2037,2055,2063,2043,2049,2041,2073,2055,2039,2051,2061,2057,2057,2051,2059,2031,2021,'
a =
'2021,2035,2013,2027,2051,2057,2041,2057,2055,2073,2051,2059,2065,2041,2027,2055,2031,2049,2039,2063,2041,2057,2037,2067,2059,2057,2003,2049,2077,2037,2035,2041,2027,2063,2061,2015,2015,2043,2061,2051,2039,2059,2065,2049,2059,2051,2041,2063,2063,2051,2027,2065,2067,2041,2021,2025,2051,2059,2041,2059,2055,2049,2057,2029,2039,2039,2023,2059,2043,2035,2041,2067,2031,2039,2049,2057,2053,2041,2005,2067,2057,2057,2043,2049,2043,2049,2059,2041,2035,2031,2061,2043,2029,2041,2067,2053,2035,2055,2029,2021,2023,2037,20'
a = '59,2063,2039,2043,2057,2037,2057,2063,2067,2027,2027,2061,2057,2009,2053,2059,2043,2051,2037,2065,2041,2061,2039,2053,2041,2065,2057,2031,2037,2037,2057,2039,2041,2055,2053,2041,2043,2039,2059,2057,2035,2039,2051,2031,2035,2037,2059,2063,2031,2039,2059,2067,2021,2035,2059,2037,2067,2053,2031,2039,2049,2025,2065,2059,2053,2043,2037,2069,2041,2033,2059,2075,2051,2035,2021,2039,2041,2031,2043,2061,2049,2039,2075,2065,2065,2051,2057,2049,2049,2039,2053,2035,2019,2067,2057,2049,2011,2059,2049,2041,2009,2063,2057'
a = ',2063]}'
a =
'{"Q":[2043,2043,2059,2063,2033,2063,2037,2053,2035,2067,2049,2033,2035,2041,2045,2037,2027,2065,2053,2037,2035,2063,2033,2043,2035,2055,2043,2043,2015,2061,2025,2075,2035,2045,2029,2037,2061,2063,2077,2051,2041,2039,2055,2033,2043,2033,2041,2019,2027,2061,2039,2053,2035,2037,2055,2057,2067,2055,2043,2059,2045,2045,2019,2051,2019,2077,2045,2027,2027,2025,2049,2073,2067,2057,2053,2033,2035,2031,2037,2045,2031,2053,2071,2055,2059,2053,2045,2045,2043,2049,2043,2037,2065,2035,2067,2049,2029,2039,2041,2045,2037,2'
a = '067,2073,2057,2013,2039,2053,2051,2045,2043,2069,2053,2048,2033,2057,2033,2057,2049,2055,2057,2055,2059,2037,2045,2049,2025,2067,2049,2049,2055,2051,2081,2061,2057,2053,2051,2023,2051,2019,2055,2035,2029,2043,2031,2049,2035,2031,2053,2039,2065,2037,2055,2033,2075,2037,2035,2027,2061,2049,2071,2075,2079,2039,2019,2035,2033,2059,2035,2033,2049,2043,2043,2073,2037,2049,2067,2039,2051,2041,2053,2063,2041,2031,2067,2051,2083,2055,2037,2053,2039,2061,2049,2051,2035,2033,2063,2059,2051,2059,2035,2029,2057,2023,202'
a = '9,2029,2043,2045,2037,2055,2049,2035,2049,2061,2059,2049,2043,2053,2039,2041,2053,2061,2075,2039,2051,2043,2059,2057,2055,2037,2073,2045,2059,2049,2023,2049,2057,2049,2041,2071,2049,2041,2053,2049,2027,2057,2051,2055,2055,2071,2073,2055,2063,2055,2043,2053,2037,2063,2077,2049,2041,2023,2033,2035,2069,2059,2059,2051,2067,2021,2063,2033,2057,2055,2033,2039,2041,2053,2081,2041,2065,2043,2053,2057,2039,2051,2043,2043,2037,2043,2063,2025,2039,2059,2053,2039,2039,2051,2051,2051,2037,2053,2049,2045,2057,2057,2065,'
a = '2063,2067,2083,2063,2037,2061,2043,2029,2035,2029,2033,2041,2029,2065,2043,2033,2059,2057,2037,2027,2043,2045,2049,2049,2039,2051,2061,2049,2037,2039,2031,2053,2065,2037,2037,2075,2049,2041,2037,2039,2057,2035,2031,2041,2037,2051,2055,2021,2037,2053,2053,2037,2017,2059,2061,2067,2029,2031,2035,2051,2051,2041,2027,2067,2039,2059,2067,2035,2041,2055,2031,2027,2033,2037,2039,2031,2053,2059,2095,2035,2033,2049,2061,2037,2059,2065,2035,2065,2055,2055,2035,2057,2067,2041,2037,2041,2033,2041,2041,2077,2061,2063,20'
a = '39,2037,2039,2067,2025,2057,2027,2055,2037,2061,2059,2033,2055,2073,2049,2055,2041,2053,2075,2041,2039,2043,2065,2043,2065,2031,2035,2059,2051,2039,2041,2055,2039,2041,2045,2043,2051,2059,2029,2037,2041,2057,2041,2075,2057,2061,2049,2049,2067,2035,2039,2035,2043,2039,2031,2043,2041,2057,2061,2049,2037,2061,2023,2039,2045,2055,2063,2033,2045,2057,2041,2023,2049,2041,2065,2063,2043,2073,2043,2037,2035,2057,2023,2043,2033,2065,2053,2055,2053,2049,2041,2057,2065,2055,2049,2043,2059,2043,2031,2039,2083,2041,2053'
a = ',2055]}'
0 Comments
Answers (1)
Vidip
on 12 Apr 2024
I understand that you want to store the I and Q data from the serial port into a table with separate columns in MATLAB, you can refer to the below MATLAB Answer thread which addresses a similar issue –
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!