フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

combined operations on struct arrays

2 ビュー (過去 30 日間)
Archit
Archit 2013 年 5 月 1 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I have a struct S
S=struct()
It has 2 fields a,b
S(1).a=2;
S(2).a=3;
S(3).a=4;
now how do i do something like
S(:).a=S(:).a+[ 5 6 7 ]

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 5 月 1 日
編集済み: Azzi Abdelmalek 2013 年 5 月 1 日
S=struct('a',cellfun(@plus, {S.a},{5 6 7},'un',0))
  4 件のコメント
Archit
Archit 2013 年 5 月 1 日
編集済み: Archit 2013 年 5 月 1 日
as i said, i want something readable which should not be cryptic so ur two answers do not serve me
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 5 月 1 日
編集済み: Azzi Abdelmalek 2013 年 5 月 1 日
What do you mean by readable?
doc cellfun

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by