i use a sensor that connected to arduino, then to MATLAB. But, all i can do is just to show plot of my sensor in my GUI, but i need the live scope. Is anyone can help?
I am not sure how arduino interacts with MATLAB. Anyways, you can make a "for" loop and read the data and update the figure each duration T millisecond. You have to use "pause" command inside the loop to wait for T milliseconds. Overwriting the plot without pausing will not work.
Second option, you can use the mouse effect (call file when you please the mouse on the graph), but I do not recommend it.
I think its pretty easy to implement script which is capable of doing what you want.
I assume that the data from your sensors is transmitted in real-time, so you can have a counter associated with time and plot each sample while holding the figure.
Here is a simple example:
%assume that your plot for 40 frames of time (here time could be in the unit
% represented by your device or sensors
t = 0;
figure; % create a figure
hold on; % turn hold on
while(1)
% receive sensor data
plot(t, sensorData, 'o');
t = t+1;
if(t >40)
t = 0;
clf; %clear figure
hold on; % again hold on after clearing
end
end % whileloop
The above example is highly simplified with the core idea of displaying real-time data. you can further modify this according to your scenarios and requirements.
You can scope in Simulink. If you used Serial.write(SensorValue); in your Arduino sketch it sends your data to serial COM port and you can use serial "Serial Configuration" and "Serial Receive" block to get sersor values in simulink.