필터 지우기
필터 지우기

Cell Arrays Graph Plot

조회 수: 1 (최근 30일)
RDG
RDG 2012년 9월 5일
Thank you for your attention. Kindly refer to the code excerpt. (It's the most concise version of code that I have written)
count = 1 : 15;
randvar=cell(50,1);
for h=1:50
randvar{h}=zeros(10,4);
randvar{h}(:,1)=randi(10,10,1);
randvar{h}(:,2)=randi(5,10,1);
randvar{h}(:,3)=randi(10,10,1);
randvar{h}(:,4)=randi(17,10,1);
end
for counter=count
for h=1:50
a{h}=0;
for i=1:10
for j=1:10-i
if randvar{h}(i,1) ~= randvar{h}(i+j,1)
if randvar{h}(i,2)==randvar{h}(i+j,2)
if randvar{h}(i,3)==randvar{h}(i+j,3)
if randvar{h}(i,4)==randvar{h}(i+j,4)
a{h}=a{h}+10;
else
a{h}=a{h}+0;
end
end
end
end
end
end
end
end
double_a = cell2mat(a);
plot(counter, double_a, 'bo-', 'LineWidth', 2, 'MarkerSize', 10);
grid on;
xlabel('counter', 'FontSize', 15);
ylabel('a value', 'FontSize', 15);
When it runs, the x-axis (counter) displays a continuous range of 14-16. What should I do to achieve a discrete range of 1-15 (as specified in the count variable). The a{h} value at every iteration should also correspond to the x-axis.
I'm relatively new in cell arrays graph plots. Any help rendered would be much appreciated.
  댓글 수: 1
per isakson
per isakson 2012년 9월 5일
Why use a cell array in the first place?

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

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2012년 9월 5일
set(gca,'xlim',[1 15])
  댓글 수: 1
RDG
RDG 2012년 9월 5일
Thank you Azzi. However, I just realized that I missed out an important piece of information. Kindly review the question.
Sorry for the inconvenience.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by