CCT(2,3,2,3)
sum =
0
0
Error in RCT3 (line 2)
syms t r theta phi p(r) q(r) a
Output argument "R" (and maybe others) not
assigned during call to "C:\Users\Shiraz
Khan\Documents\MATLAB\RCT3.m>RCT3".
Error in CCT (line 13)
sum=sum+g(i,m)*RCT3(j,k,l,m);

2 comentarios

Geoff Hayes
Geoff Hayes el 10 de Jul. de 2018
shiraz - can you share the code for RCT3.m? Given the error message, the R output parameter is not being set given your inputs.
Geoff Hayes
Geoff Hayes el 11 de Jul. de 2018
Shiraz's answer moved here
function [R]= RCT3(i,j,k,m)
syms t r theta phi p(r) q(r) a
g=[exp(p(r)) 0 0 0; 0 -exp(q(r)) 0 0; 0 0 -r^2 0; 0 0 0 -r^2*(sin(theta))^2];
x= [t r theta phi];
A=diff(SRH2(i,k,m),x(1,j));
% pretty(A)
B=diff(SRH2(i,j,m),x(1,k));
% pretty(B);
sum1=0;
for n=1:4
sum1=sum1+SRH2(i,k,n)*SRH2(n,j,m);
end
sum1;
% pretty(sum1)
sum2=0;
for n=1:4
sum2=sum2+SRH2(i,j,n)*SRH2(n,k,m);
end
sum2;
% pretty(sum2)
sum=A-B+sum1-sum2;
sum;
pretty(sum)
end

Iniciar sesión para comentar.

 Respuesta aceptada

Geoff Hayes
Geoff Hayes el 11 de Jul. de 2018

0 votos

Shiraz - your function signature is
function [R]= RCT3(i,j,k,m)
which means that the output parameter from your function is named R and so you must initialize a local variable (within your code) with that same name. If you don't do this, then you will get the Output argument "R" (and maybe others) not assigned during call.
Perhaps this is the sum local variable in your code? If it is, then rename it to R. If it isn't, then rename it anyway since it will conflict with the MATLAB built-in function sum.

Más respuestas (0)

Etiquetas

Preguntada:

el 10 de Jul. de 2018

Respondida:

el 11 de Jul. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by