Info

This question is closed. Reopen it to edit or answer.

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

1 view (last 30 days)
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 Comments
Adam Danz
Adam Danz on 16 Jan 2020
Edited: Adam Danz on 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

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!