Function is not running. please help me.

I have a program (attached) namely singletradecal.m . When i run it works fine. When i run through function(attached tcfun5.m) it is not running. I think local function withing the function is not running. Please help me fixing the problem.
Trade =[3 3 3 3 4 1 2 4]; %
Q = [ 46 46 46 46 46 46 46 46 ]; %Total Quantity
BP = [ 3500 3600 3700 3700 3800 3800 3700 3500]; % Buy Price
SP = [ 3508.1 4000 3800 3900 4000 3900 3900 3700]; % Sell price
Exch = [1 1 1 1 1 1 1 1];
[NETPL5, CHARGES5, SPOST5, STT5, TVS5, ETC5, IGST5, BROKERAGE5, SEBI5, STAMPDUTY5, DP5, MARGIN5, OCHARGES5, PAYINOUT5] = tcfun5(Q, BP, SP, Trade, Exch)
NETPL5 =
0
CHARGES5 =
0
SPOST5 =
0
STT5 =
0
TVS5 =
0
ETC5 =
0
IGST5 =
0
BROKERAGE5 =
0
SEBI5 =
0
STAMPDUTY5 =
0
DP5 =
0
MARGIN5 =
0
OCHARGES5 =
0
PAYINOUT5 =
0

2 comentarios

Walter Roberson
Walter Roberson el 26 de Jul. de 2022
It seems to be running. It returns all zeros though.
It gives zero. But Actually, local function within the function is not running. when i run singletradecal.m it gives right values.
NETPL
NETPL =
62214.68
>> CHARGES
CHARGES =
-2557.92
>> SPOST
SPOST =
64450.36
>> STT
STT =
2146
>> TVS
TVS =
136.64
>> ETC
ETC =
94.19
>> IGST
IGST =
24.6
>> BROKERAGE
BROKERAGE =
40
>> SEBI
SEBI =
2.45
>> STAMPDUTY
STAMPDUTY =
161
>> DP
DP =
89.68
>> MARGIN
MARGIN =
64772.6000000001
>> OCHARGES
OCHARGES =
282.24
>> PAYINOUT
PAYINOUT =
64732.6000000001

Iniciar sesión para comentar.

 Respuesta aceptada

David Hill
David Hill el 26 de Jul. de 2022
Works. Just copy and paste singletradecal into your function or run the script inside the function.
function [NETPL, CHARGES, SPOST, STT, TVS, ETC, IGST, BROKERAGE, SEBI, STAMPDUTY, DP, MARGIN, OCHARGES, PAYINOUT] = tcfun5(Q, BP, SP, Trade)
singletradecal;
end

Más respuestas (0)

Categorías

Productos

Versión

R2020a

Preguntada:

el 26 de Jul. de 2022

Respondida:

el 26 de Jul. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by