matrix indexing and for loops
Mostrar comentarios más antiguos
Hi I am still learning the ropes with Matlab and have another problem I am not sure how to get round.
I have a matrix Z which is 12x65044 and I would like to peform an operation on each individual column of the matrix. How can I do this automatically?
Perhaps something along the lines of for: Z columns(1:65044) ... perform desired function ... and then store the output vector from each function into one new matrix say Z2???
Thanks for help
4 comentarios
Sean de Wolski
el 19 de Jul. de 2011
What is the function? It can probably (hopefully) be done without loops or arrayfun, but we need to know the operation.
scour_man
el 19 de Jul. de 2011
Jan
el 19 de Jul. de 2011
Yes, it is possible and already posted by Andrei.
Sean de Wolski
el 19 de Jul. de 2011
@scour_man: Not being familiar with ARMASA, I have no idea.
@Jan: I was wondering if the function was numerical - we could then probably do it with a convolution.
Respuesta aceptada
Más respuestas (1)
Jan
el 20 de Jul. de 2011
Usually error messages do not tell only the reason of an error, but also the location. And without knowing in which line the error appears, it is impossible to fix it. Without the location, an error message is not "complete".
A more direct solution of your problem would be to use the debugger to let Matlab stop, when the error appears:
dbstop if error
Then inspect the contents of the used variables in the command window or workspace browser. Then you will find out, that the dimension of the lefthand side and the righthand side of an assignment do not match. E.g. "Z2(:, j1)" is a vector, but arma2pred replies an array of a different size, e.g. empty, or matrix.
Categorías
Más información sobre Loops and Conditional Statements 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!