Info

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

# When I use the function it just ignore all the outputs a part from the first one.

1 Ansicht (letzte 30 Tage)
Annalisa Schiavon am 16 Jan. 2020
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
function [SOFM,VSI,INC,TO,FROM,NET,NPSO,ALL,rowNames,colNames,VSTable] = VS(x)
SOFM=x.*100;
VSI=sum(sum(SOFM-diag(diag(SOFM)),2)/size(x,2));
INC=sum(SOFM,1);
TO=sum(SOFM-diag(diag(SOFM)),1);
FROM=sum(SOFM-diag(diag(SOFM)),2);
NET=TO-FROM;
NPSO=transpose(SOFM)-SOFM;
ALL = cat(1,cat(1,[SOFM,FROM],[TO, "NaN"]),[INC "NaN"]);
rowNames = {'Stocks' ,'Bonds' ,'Commodities', 'FX', 'Directional TO others' ,'Directional including own'};
colNames = {'Stocks' 'Bonds' 'Commodities' 'FX' 'Directional_FROM_others'};
VSTable = array2table(str2double(ALL),'RowNames',rowNames,'VariableNames',colNames);
end
When I use this function, why is it just considering the first output(SOFM) and it stops there without computing the others output? Thank you :)
##### 3 Kommentare1 älteren Kommentar anzeigen1 älteren Kommentar ausblenden
Adam Danz am 16 Jan. 2020
Bearbeitet: Adam Danz am 16 Jan. 2020
I bet Spencer is right (maybe Spencer should move the comment to the answers section).
If you want all of the output variables stored within 1 output,
function out = VS(x)
. . .
out = {SOFM,VSI,INC,TO,FROM,NET,NPSO,ALL,rowNames,colNames,VSTable};
end
Annalisa Schiavon am 16 Jan. 2020
Yes thank you, that was the problem!

### Community Treasure Hunt

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

Start Hunting!

Translated by