Cell Arrays Graph Plot

2 次查看(过去 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.

采纳的回答

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