Info

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

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

1 回表示 (過去 30 日間)
Annalisa Schiavon
Annalisa Schiavon 2020 年 1 月 16 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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 件のコメント
Adam Danz
Adam Danz 2020 年 1 月 16 日
編集済み: Adam Danz 2020 年 1 月 16 日
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
Annalisa Schiavon 2020 年 1 月 16 日
Yes thank you, that was the problem!

回答 (0 件)

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by