ThinkGear, rawdata and Matlab coding
6 views (last 30 days)
Show older comments
Marijana Teljega
on 24 Aug 2018
Edited: madhan ravi
on 27 Aug 2018
Hi, I am new in Matlab programming, but have experience i Java code, wich is helping but sometimes really confused, questioning if I am coding in correct way. I appriciate any help with my questions. I use similar code https://www.pantechsolutions.net/brain-computer-interface/matlab-code-to-read-raw-eeg-signals-using-mindwave-mobile to read raw data from the headset, and I have several question:
1. How can I found out what data type is inside the Data= zeros(1,1000);
2. In the end of the code there are two rows that free the connection and disconnect. I would like to free the connection and disconnect when I need to do that, like for example when I press letter A on the keyboard.
3. What is the difference between plot(data); and disp(data)? I mean, I understand what they do, but if I place them one after the other, the value in the signal is givin only zeros but plot function will plot the signal with values other than zeros?
4. I need to use this equation on the Data values: (rawdata*(1,8/4096)/2000). Can I write the equation in one row or I need to split it in several steps to get the correct answer? In other words, I guess that Matlab is handling the equation in the correct way, calculating the most important part first when using parantesis?
5. I am using really nice function [s, f, t, ps] = spectrogram(data,window,noverlap,NFFT,Fs,'yaxis' ); wich help me a lot solving many things in one row. I want to plot ps, but ps contains complex numbers. How can I plot ps?
I really appriciate any help in my questions.
Marijana
Accepted Answer
madhan ravi
on 24 Aug 2018
Edited: madhan ravi
on 24 Aug 2018
1) To find what data type just type whos in command window.
2)Didn't understand ,but I guess you can do this by defining it as an input function for example:
DISCONNECT = input('disconnect?')
if size(DISCONNECT) == 1
break
end
3)Yes plot function can plot other than zeros.
4)Yes it calculates the most important part inside parantheses.
5)Read the link below:
2 Comments
madhan ravi
on 27 Aug 2018
Edited: madhan ravi
on 27 Aug 2018
Difference
Generally in matlab we use the term vector for dimensional data (1 by any number or vice versa). Matrix is with dimension (any number by any number) other than one.
2) Disconnection Just use it where you have commented disconnect.
3) plot link:
https://www.mathworks.com/help/matlab/ref/plot.html
4) Element wise operation:
https://www.mathworks.com/help/matlab/ref/times.html
5) Complex as integers
I don’t know what you mean but what I know is you can save the real and imaginary parts of a complex number separately.
Plotting ps example
plot(real(ps),imag(ps),'-r').
More Answers (0)
See Also
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!