I am using this like which works fine:
Cellcount=Acc.perhexagon(Ac.time==data.timepoints(end).time);
I want to get information not only from the last timepoint. I want to have info from zeor timepoint to final time point with the step of 2. 0, 2, 4, 6, ...,end or something like this: 0:2:end
What would be the easiest way?

6 件のコメント

Daniel M
Daniel M 2019 年 10 月 8 日
You should read about how to assign output from a comma-separated list.
Zeynab Mousavikhamene
Zeynab Mousavikhamene 2019 年 10 月 8 日
@Daniel Martire This link uses for loop and I want to avoid it.
Rik
Rik 2019 年 10 月 8 日
Your goal is not very clear to me, but often if you test for equality in a loop, ismember can provide a speedup.
Daniel M
Daniel M 2019 年 10 月 8 日
You clearly didn't read the article. Look closer at the deal() function.
Alaster Meehan
Alaster Meehan 2019 年 10 月 8 日
Tru using arrayfun.
Something like:
Cellcount = Acc.perhexagon( arrayfun(@(x) (x.time == Ac.time), data.timepoints(1:2:end)) );
Note, because you are indexing an array you will need to start from 1 not 0.
structfun might also work.
Cheers Alaster
Daniel M
Daniel M 2019 年 10 月 8 日
Note that arrayfun is just a for loop internally.

サインインしてコメントする。

回答 (1 件)

Srivardhan Gadila
Srivardhan Gadila 2019 年 10 月 11 日

0 投票

You may refer to arrayfun, structfun & splitapply.

カテゴリ

ヘルプ センター および File ExchangeData Type Identification についてさらに検索

タグ

質問済み:

2019 年 10 月 8 日

回答済み:

2019 年 10 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by