Cell Arrays Graph Plot

2 visualizzazioni (ultimi 30 giorni)
RDG
RDG il 5 Set 2012
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 Commento
per isakson
per isakson il 5 Set 2012
Why use a cell array in the first place?

Accedi per commentare.

Risposta accettata

Azzi Abdelmalek
Azzi Abdelmalek il 5 Set 2012
set(gca,'xlim',[1 15])
  1 Commento
RDG
RDG il 5 Set 2012
Thank you Azzi. However, I just realized that I missed out an important piece of information. Kindly review the question.
Sorry for the inconvenience.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Graph and Network Algorithms in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by