Animation troubles
古いコメントを表示
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 件のコメント
Patrick Kalita
2011 年 7 月 15 日
Did you try something like the example in this documentation page: http://www.mathworks.com/help/techdoc/ref/movie.html
Can you be more specific about what you have tried and why it didn't suit your needs?
Nathan
2011 年 7 月 15 日
Patrick Kalita
2011 年 7 月 18 日
You might want to start a new question.
回答 (3 件)
Walter Roberson
2011 年 7 月 16 日
0 投票
You can write your movie using VideoWriter or (for older versions) move2avi. Once you have done that you can use implay()
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
カテゴリ
ヘルプ センター および File Exchange で Animation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!