Index in position 1 exceeds array bounds (must not exceed 1). How do I fix this error?
Mostrar comentarios más antiguos
n = input('Number of dice: '); %number of dice being rolled
numberOfExperiments = input('Number of trials: ');
faces = input('Number of faces: ');
a = {'G1' 'g1'}
b = {'G2' 'g2'}
X = randn(numberOfExperiments, 2)
for rows = 1:numberOfExperiments
i =randperm(length(a),1)
A=a(i)
B=b(i)
Anew = cell2mat(A)
Bnew = cell2mat(B)
for cols = 1:2
C(:,cols) = X(Anew, Bnew)
end
C(rows, :) = X(Anew, Bnew)
end
1 comentario
Image Analyst
el 19 de Jul. de 2020
What is the purpose of a and b? And what is faces used for? You never use it. Put in some comments to explain it to us. Often if you put in comments, you'll realize the error on your own.
Respuesta aceptada
Más respuestas (0)
CategorÃas
Más información sobre Vector Data en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!