function data=coa08xxx_lines(n)
load xydata
for u=X(:,n)
for i=Y(:,n)
data= plot(u,i);
end
end
end
This code only plots the graph of n, but i want it to plot all the graps. for example if n=3, then i want the plot of 3, 2 and 1 to appear as subplots.

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 11월 15일
편집: Azzi Abdelmalek 2013년 11월 15일

1 개 추천

function data=coa08xxx_lines(n)
load xydata
ii=ceil(n/3);
jj=ceil(n/ii);
for k=1:n
subplot(ii,jj,k)
plot(u(:,k),y(:,k));
end

댓글 수: 5

vishant m.
vishant m. 2013년 11월 15일
This does not seem to give the required answer, it gives single empty graphs.
Azzi Abdelmalek
Azzi Abdelmalek 2013년 11월 15일
편집: Azzi Abdelmalek 2013년 11월 15일
Try this
function data=coa08xxx_lines(n)
data=load('xydata');
%If xydta contains x and y variables
y=data.y;
u=data.u;
ii=ceil(n/3);
jj=ceil(n/ii);
for k=1:n
subplot(ii,jj,k)
plot(u(:,k),y(:,k));
end
vishant m.
vishant m. 2013년 11월 15일
편집: Azzi Abdelmalek 2013년 11월 15일
still doesnt work,
this is the closest i got:
function data=coa08xxx_lines2(n)
load xydata;
u=X(:,n);
i=Y(:,n);
while n>=1;
n=n-1;
data=plot(u,i);
end
end
i am sure that this is correct but its missing something?! it only plots n, but i wan n,n-1,n-2....
function data=coa08xxx_lines(n)
data=load('xydata');
%If xydta contains x and y variables
y=data.Y;
u=data.X;
ii=ceil(n/3);
jj=ceil(n/ii);
for k=1:n
subplot(ii,jj,k)
plot(u(:,k),y(:,k));
end
vishant m.
vishant m. 2013년 11월 15일
편집: vishant m. 2013년 11월 16일
That works,thanks alot. but can you give me a brief explanation of how it works. The code also works only when n=<9 , i want it to ignore n if n>9 and just plot n=9.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기

질문:

2013년 11월 15일

편집:

2013년 11월 16일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by