Select specific elements in a cell array
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
SreeHarish Muppirisetty
il 19 Set 2014
Commentato: SreeHarish Muppirisetty
il 19 Set 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
Risposta accettata
Image Analyst
il 19 Set 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
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Cell Arrays 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!