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 日間)
mohammad
mohammad 2014 年 6 月 20 日
回答済み: Roberto 2014 年 6 月 21 日
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 Center および File ExchangeArgument Definitions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by