Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Creating a matrix where the entry in the second column is (weakly) less than the entry in the first column
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I would like to create a matrix where the entry in the second column is less than the entry in the first column:
A
= [ 1 0;
1 1;
2 0;
2 1;
2 2]
I can write loops but I would think there should be more efficient way. Please advise.
1 comentario
the cyclist
el 5 de Jun. de 2017
You haven't been specific enough. For example, would this be OK?
A = rand(5,1);
A(:,2) = A(:,1) - pi;
I expect not.
Respuestas (1)
Image Analyst
el 5 de Jun. de 2017
This will do it (one of an infinite number of ways):
A(:, 2) = A(:, 1) - 1
0 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!