how can i call up either part of the results like (e1,e5,e6,e9)or (from e1 to e7)? then i need to combin them in one array
9 views (last 30 days)
Show older comments
if i have a lot of arrays with different dimensions and their names take the following forms :e1,e2,e3,...,e10 and so on. how can i call up either part of the results like (e1,e5,e6,e9)or (from e1 to e7)? then i need to combine them in one array . for your information , these array names resulted from this code :
a=[1:10];
c=length(a)
for k=1:10;
if (k<c)
b{k}=nchoosek(a,k)
end
end
0 Comments
Answers (1)
Roberto
on 21 Jun 2014
I'm assuming that the results e1, e2, e3... in the code you wrote is b{k}... you might get your results as an numeric array or as a cell array
Array form: Results 1 to 4
myArray = [b{1:4}]
Cell form: Results 7 to 2
myCell = b{7:-1:2}
Array form: Results 4 to last
myArray = [b{4:end}]
Cell form: Results 3, 6 and 2
myCell = b{[3,6,2]}
Array form: Every other result
myArray = [b{1:2:end}]
0 Comments
See Also
Categories
Find more on Argument Definitions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!