# I have a 6000x9424x50 matrix and want to convert it into 6000x9424x10 and 6000x9424x20?? I meant to to split 50 bands to 10 or 20 bands individually?

2 visualizzazioni (ultimi 30 giorni)
pranav il 22 Feb 2016
Modificato: Stephen23 il 8 Mar 2016
band1(6000:9424;10) will this work?
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

David Sanchez il 22 Feb 2016
your_matrix = rand(6000,9424,50); % random matrix
M_10 = your_matrix(:,:,1:10); % 10 bands
M_20 = your_matrix(:,:,11:30); % 20 next bands
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Più risposte (1)

Stephen23 il 22 Feb 2016
Modificato: Stephen23 il 22 Feb 2016
For the most generalized solution use mat2cell:
>> X = rand(600,942,50); % fake data
>> C = mat2cell(X,size(X,1),size(X,2),[10,10,20,10]) % split matrix
>> size(C{1}) % size of the first submatrix
ans =
600 942 10
>> size(C{3}) % size of the third submatrix
ans =
600 942 20
Note:
• the submatrices are accessed using cell array indexing into C: e.g. C{1}, C{2}, etc.
• the dimension arguments must sum to equal the size of that dimension, e.g. sum([10,10,20,10])==50.
##### 2 CommentiMostra NessunoNascondi Nessuno
pranav il 8 Mar 2016
Modificato: pranav il 8 Mar 2016
Thank You. The image has 50 bands. But i want to seperate it to 1-10 1-20 1-30 1-40 bands. Can you help me.
Stephen23 il 8 Mar 2016
Modificato: Stephen23 il 8 Mar 2016
It is not clear what " i want to seperate it to 1-10 1-20 1-30 1-40 bands" means. How do you intend to split 50 into 10 + 20 + 30 + 40 ? Do they overlap or are they separate cases?

Accedi per commentare.

### Categorie

Scopri di più su Image Processing Toolbox 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!

Translated by