How to take elements row wise or column wise in a 2d array
Mostrar comentarios más antiguos
A is a 5*5 array. Its needed to take 7 elements along the 1st column and 2 from the beginning of 2nd column.So the window size is 7.Now that makes it possible to take 3 windows.So 4 elements are left.this last window should be 4 leftover elements and rest zeroes.How to have a loop that gives me the 4 windows in a variable
3 comentarios
per isakson
el 31 de Dic. de 2016
Without a loop
>> A=magic(5);
>> reshape( [A(:);zeros(3,1)], [7,4] )
ans =
17 6 25 16
23 12 8 22
4 18 14 3
10 1 20 9
11 7 21 0
24 13 2 0
5 19 15 0
MSP
el 1 de En. de 2017
Editada: per isakson
el 1 de En. de 2017
per isakson
el 1 de En. de 2017
In your question you say
- "a 5*5 array"  
- "take 7 elements [window] along"  
- "that gives me the 4 windows in a variable"  
- "matrix signalprocess"  
"generalize"   Yes, but in what way? Arbitrary size of the input matrix and/or the window? Along columns or rows? ...
Respuesta aceptada
Más respuestas (0)
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!