Error at '(' in first line of code

I am getting several errors on this line of code. The first is a error at '(' between size and 1. The next is at the ')' at the end of the line. Please help me understand what I am missing The input for the moonpos function is (vector of julian days in TDT time scale; output coordinate type). There could be a problem with the input but I am not sure.
function [X,Y,Z]=moonpos(size(1);elpdt)

4 comentarios

Adam
Adam el 9 de Jul. de 2018
Editada: Adam el 9 de Jul. de 2018
size(1)
is not valid syntax in a function definition. You should simply have variable names, not indexing into them, and 'size' certainly should not be a variable name.
I've never tried it, but I doubt ; is valid syntax in a function definition either. Arguments are separated by commas.
dpb
dpb el 9 de Jul. de 2018
Is this really an attempt to define the function prototype here or an attempt to translate what the prototype is thought to be?
Evan Mossel
Evan Mossel el 9 de Jul. de 2018
Editada: Walter Roberson el 9 de Jul. de 2018
I tried to search through the library https://www.mathworks.com/matlabcentral/fileexchange/56041-moon-position to find when the moonpos inputs are defined. Thst was the best I could come up with. I am not sure how else to define a time vector.
Walter Roberson
Walter Roberson el 9 de Jul. de 2018

Iniciar sesión para comentar.

 Respuesta aceptada

Walter Roberson
Walter Roberson el 9 de Jul. de 2018
function [X,Y,Z] = moonpos(julian_days, elpdt)
When you are declaring or calling a function, you must use comma between arguments, not semi-colon.
When you are declaring a function, the list of parameters in () must be pure variable names or the character ~ (by itself), not expressions.
In MATLAB, you do not declare the sizes of the parameters in the function declaration.

Más respuestas (0)

Categorías

Más información sobre Functions en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 9 de Jul. de 2018

Comentada:

el 9 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