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 (최근 30일)
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

답변 (1개)

Roberto
Roberto 2014년 6월 21일
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}]

카테고리

Help CenterFile Exchange에서 Argument Definitions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by