2013-05-08 1172 views
2

在MATLAB中,我需要创建一个循环遍历整个字符串数组和图。MATLAB:通过循环数组遍历

换句话说,第一次迭代:循环步骤蒙大拿州的价值(23,45),并产生情节。

第二次迭代:继续循环到格鲁吉亚与它的价值(54,75)和阴谋。

第三次迭代:继续使用它的值(55,90)和绘图循环到德克萨斯州。所以,我们对每个字符串有3个不同的图。

这里是数组:

A = {'Montana','Georgia','Texas'}; 

与X的值:

X = [23, 54, 55] 

与Y值:

Y = [45, 75, 90] 

谢谢,

阿曼达

回答

3
% input data 
A = {'Montana','Georgia','Texas'}; 
X = [23, 54, 55]; 
Y = [45, 75, 90]; 

% plot points 
figure(1); 
plot(X, Y, 'rx'); 

% adjust the limits for figure axis 
axis([0 70 0 100]); 

% label points 
text(X,Y, A, 'VerticalAlignment','bottom', ... 
    'HorizontalAlignment','right'); 

输出数字 Output