Animation troubles
13 views (last 30 days)
Show older comments
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 Comments
Answers (3)
Walter Roberson
on 16 Jul 2011
You can write your movie using VideoWriter or (for older versions) move2avi. Once you have done that you can use implay()
0 Comments
hananel byk
on 7 Feb 2012
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 Comments
See Also
Categories
Find more on Animation 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!