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 日間)
古いコメントを表示
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);
0 件のコメント
回答 (1 件)
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.)
0 件のコメント
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!