Animation troubles
조회 수: 19 (최근 30일)
이전 댓글 표시
Hey all,
I need to make some sort of an animation for sensors and their acceleration readings over time. Ideally, I would want the x and y axes to be the sensors in their appropriate locations (4 arrays of 5 sensors), with the z (vertical) axis being their acceleration reading, while having some sort of animation that changes the z values as time goes on. Something like a spectrogram would work. I have spreadsheets of the acceleration readings of each sensor per unit of time. I have tried movies, animated 3D plots (surf, etc) but to no avail. Can anyone offer any assistance? Thanks in advance.
Nathanf.
SEE BELOW for updated situation
댓글 수: 3
답변 (3개)
Walter Roberson
2011년 7월 16일
You can write your movie using VideoWriter or (for older versions) move2avi. Once you have done that you can use implay()
댓글 수: 0
hananel byk
2012년 2월 7일
You should use a toggle button and a global variable (or a variable you keep in the handle structure) that would keep the index where you stoped running the animation. Whenever you push the toggle button, it first whether it's on or off, if it's on then it will start a 'while' loop that stops when the animation finish or the 'Value' of the button change back to 0. At the end of the animation the global variable get back to [] (empty). For example: (the button is called play_button)
% --- Executes on button press in play_button. function play_button_Callback(hObject, eventdata, handles) % hObject handle to play_button (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
global ind %this global variable hold the current index global signal %the signal matrix to plot it's raws
if get(handles.play_button,'Value'); set(handles.play_button,'String','Pause');
if isempty(ind)
k=1;
else
k = ind;
end
while k<=size(signal,1) && get(handles.play_button,'Value');
plot(signal(k,:));
k=k+1
ind=k;
end
if get(handles.play_button,'Value');
kInd = [];
end
else
set(handles.play_button,'String','Play');
end
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Animation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!