I have tried everything and I have no luck.

1 visualización (últimos 30 días)
Connor Maddox
Connor Maddox el 4 de Oct. de 2016
Editada: Connor Maddox el 5 de Oct. de 2016
fsadf
  1 comentario
James Tursa
James Tursa el 4 de Oct. de 2016
Please show what you have done so far, and ask specific questions about where you are having problems.

Iniciar sesión para comentar.

Respuestas (1)

Sima
Sima el 4 de Oct. de 2016
What have you tried?
You don't need a loop in Matlab, length(find(X>10)) will give you the number of elements in X that are greater than 10.
disp will display whatever string you give it and mat2str will convert any matrix to a string.
  2 comentarios
Connor Maddox
Connor Maddox el 4 de Oct. de 2016
I know I do not need a loop to complete the answer but that is what the assignment says to do.
Sima
Sima el 4 de Oct. de 2016
it's not as efficient but you can do:
larger_than_ten=0;
for i=1:length(X)
if (X(i)>10)
larger_than_ten=larger_than_ten+1;
end
end

Iniciar sesión para comentar.

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by