Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

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 Ansicht (letzte 30 Tage)
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);

Antworten (1)

Walter Roberson
Walter Roberson am 1 Jun. 2018
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.)

Diese Frage ist geschlossen.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by