フィルターのクリア

Info

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

Whats wrong with the below equation , I get an error message when i keep this equation in a for loop to run multiple times.

1 回表示 (過去 30 日間)
Sagar  Saxena
Sagar Saxena 2018 年 6 月 1 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Expected one output from a curly brace or dot indexing expression, but there were 2 results.
Error in line : I= obj.mhm.S(a)*(abs(obj.mhm.Phi(:,:,a)).^2);

回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 6 月 1 日
Either obj or obj.mhm (more likely) are non-scalar structs or objects. non-scalar structs or objects produce multiple outputs when they are indexed further.
Potential correction:
Sa = arrayfun(@(Sarray) Sarray(a), obj.mhm.S);
Phia = arrayfun(@(Phiarray) abs(Phiarray(:,:,a)).^2, obj.mhm.Phi, 'uniform', 0);
I = arrayfun(@(IDX) Phi{IDX} * Sa(IDX), 1:length(Phia), 'uniform', 0);
This would be a cell array of values. It needs to be a cell array because you have multiple obj.mhm and for each one of them you are extracting a 2D array from the Phi field. (Well, you could convert the result to a 3D array instead of a cell array.)

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by