how to i attain a matrix with 1 to n
Mostrar comentarios más antiguos
when i prompt a user for a value for m,n how do i attain a matrix such that the first row of a matrix be 1 to m for eg.if a user input a value of 9 for m the first row of a matrix will be: 1 2 3 4 5 6 7 8 9
similarly, if the user enter a value of 6 for n, then my first column will be 1 2 3 4 5 6
please kindly advise,thanks alot!
2 comentarios
Wayne King
el 1 de Oct. de 2013
You have not said how you are filling in the other entries of the matrix.
We can't have the user get 9 columns with your row vector and then have one column of 6 elements. You have created a 9x6 matrix, how do you want us to fill in the missing elements?
Austin
el 1 de Oct. de 2013
Respuesta aceptada
Más respuestas (3)
Austin
el 1 de Oct. de 2013
0 votos
1 comentario
Wayne King
el 1 de Oct. de 2013
see my response below
Austin
el 1 de Oct. de 2013
Editada: Wayne King
el 1 de Oct. de 2013
1 comentario
Wayne King
el 1 de Oct. de 2013
You changed your code so now it works, initally you had the wrong numbers in your column and row assignment.
The above will work but you are just filling the last column and last row, is that what you want?
Austin
el 1 de Oct. de 2013
0 votos
Categorías
Más información sobre Direct Search 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!