Info

此问题已关闭。 请重新打开它进行编辑或回答。

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

1 次查看(过去 30 天)
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

回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by