I'm quite new to MATLAB and therefore any help is very appreciated.
I want to visualize multiple vectors using MATLAB's compass graph. Is it possible to colorize the different vectors? Those vectors change over time and the order in which they're handed to the compass graph never changes. Is there another way to distinguish the vectors?
Thank you in advance! M.
EDIT: The solution works (i.e. arrows are colored) until the very last vector element of the compass is reached. If I do not stop the loop before, the method exits with the error ??? Subscript indices must either be real positive integers or logicals..
Every object (i.e. arrows) of the compass is correctly adressed except the last; checked the indexes, everything seems to be ok.What can I do?
Here's the code I currently use:
handle = compass(viewframe(1,:),viewframe(2,:));
colors = get(0,'DefaultAxesColorOrder');
for i=1:length(handle)
set(handle(i),'color', colors(mod(i,length(colors)),:))
end
You could do this:
Z = compass(eig(randn(5)));
colors = get(0,'DefaultAxesColorOrder')
for i=1:length(Z)
set(Z(i),'color',colors(mod(i-1,length(colors))+1,:))
end