function [isa isb isc] = CircuitGetStatorCurrent(Circuit)

Schematic=Circuit.Schematic;
BranchCurrents=Circuit.BranchCurrents;
iNaNBranchCurrents=isnan(BranchCurrents);
iNaNBranchCurrents=find(diff([0; iNaNBranchCurrents])==1);
iBranchCurrents=find(~isnan(BranchCurrents));
iBranchCurrents=sort([iBranchCurrents; iNaNBranchCurrents]);
BranchCurrents=BranchCurrents(iBranchCurrents);
for nBranch=1:length(Schematic)
    Branch=Schematic{nBranch,1};
    if strcmp(Branch.circuittype,'statorcircuit')
        Components=Branch.Components;
        for i=1:length(Components)
            component=Components{i,1};
            if strcmp(component.type,'coil')
                npath=component.value.npath;
                if strcmp(component.value.phase,'a')
                    isa(npath,1)=BranchCurrents(nBranch);
                elseif strcmp(component.value.phase,'b')
                    isb(npath,1)=BranchCurrents(nBranch);
                elseif strcmp(component.value.phase,'c')
                    isc(npath,1)=BranchCurrents(nBranch);
                end
            end
        end
    end
end
