Select specific elements in a cell array

11 visualizaciones (últimos 30 días)
SreeHarish Muppirisetty
SreeHarish Muppirisetty el 19 de Sept. de 2014
Comentada: SreeHarish Muppirisetty el 19 de Sept. de 2014
Hi
I have a cellarray variable 'noisyobs', whose length is 15.
noisyobs{1 to 4}..size of each one is 1X1800.
noisyobs{5 to 15}..size of each one is 1X60.
Now I want to do as described below:
% for loop running as many times as noisyobs cell array length
for eachindexvalue=1:length(noisyobs)
% assign to a new cell array variable whose length is always 14 (one less than length(noisyobs)
% i.e.,
newnoisyobs=noisyobs{?}; % Where I assign all the elementsof noisyobs except of the index 'eachindexvalue' % to new cellarray variable newnoisyobs
end %end for loop
How can I achieve this?
Thank you for your time
If not clear, will try to explain with more clarity.
Harish

Respuesta aceptada

Image Analyst
Image Analyst el 19 de Sept. de 2014
Try this (untested):
for k=1:length(noisyobs)
allIndexes = 1 : length(noisyobs);
% Remove the kth one:
allIndexes(k) = [];
% Assign what's left:
% Put the whole 14 element cell array into the kth cell of a new cell array.
newnoisyobs{k} = noisyobs(allIndexes);
end

Más respuestas (0)

Categorías

Más información sobre Cell Arrays en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by