how to add the first row all the odd columns by step of 2 odd columns
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
juveria fatima
il 1 Set 2018
Modificato: Image Analyst
il 1 Set 2018
I want to add 1 and 3 the 2 and 1. Then moving to second row I want to add 1 and 1 then 4 and 5. Similarly I want to, in general, using using loop for an image
a = [...
1 2 3 1
1 4 1 5
5 8 5 9
1 9 2 1]
2 Commenti
Risposta accettata
madhan ravi
il 1 Set 2018
Modificato: madhan ravi
il 1 Set 2018
Try this:
a1=a(:,1:2:end) %for odd columns
a2=a(:,2:2:end) %for even columns
oddcolumns=sum(a1,2)
evencolumns=sum(a2,2)
a
15 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Resizing and Reshaping Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!