How can i group each column of a matrix after i split a matrix into columns.

for eg, i have a matrix "mat = 10*rand(x,y)"
after i split the matrix by columns into y number of groups,how can i group them in such a way that grp1=column1 of matrix mat, grp2=column2 of matrix mat and so on..... all the way until group y = column y of the matrix?

Respuestas (2)

Sean de Wolski
Sean de Wolski el 5 de Nov. de 2013
Editada: Sean de Wolski el 5 de Nov. de 2013
I would avoid creating the groups like you're proposing ( FAQ) and instead continue to operate on the matrix as it is.
What is your end goal? Given:
mat = 10*rand(6,7)
What do you want to do with mat?

3 comentarios

Austin
Austin el 5 de Nov. de 2013
Editada: Austin el 5 de Nov. de 2013
i would like to obtain the maximum value of each column in this a random matrix w/o the use of inbuilt function max.
What do you have against max()???
How about
-min(-mat)
or
nanmax(mat)
?

Iniciar sesión para comentar.

mat=rand(x,y)
for k=1:size(mat,2)
c=mat(:,k) % your column k
% Do what you want
end

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 5 de Nov. de 2013

Editada:

el 5 de Nov. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by