Home how to change size(out) = [m n] in matlab
Reply: 1

how to change size(out) = [m n] in matlab

nobel
1#
nobel Published in 2015-02-21 20:44:27Z

This is a continuation of my previous problem, so now i want to know how to change array size and how to use size(out) = [m n].

so basically if you have 10x10 array and you want to plot column 9 vs. column 10 in scatter plot, and you want column 1-column 8 to be the labels of your scatter plot. how can i use size(out) = [10 10]?

for someone who want examples:

Auto-Label in scatter plot using matlab

and what if your array is m x n? is there a general code for this? please enlighten me, thanks.

Benoit_11
2#
Benoit_11 Reply to 2015-02-21 21:08:21Z

To make things more general you can make use of the end keyword, which refers to the last row/column or an array/cell array/anything in Matlab (actually "last array of index").

Revisiting your example, you could use num2str (alternatively to sprintf) and use the following:

scatter(out(:,end-1), out(:,end));

for k = 1:size(out,1)

T{k} = num2str(out(k,1:end-2));

end

xshift = 0.03; yshift = 0.03;

text(out(:,3)+xshift, out(:,4)+yshift, T);
grid on

Which gives this:

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.35188 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO