Select specific elements in a cell array
8 次查看(过去 30 天)
显示 更早的评论
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
采纳的回答
Image Analyst
2014-9-19
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Cell Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!