Borrar filtros
Borrar filtros

[Noob here] I need help with a file exchange which uses MATLAB function

32 visualizaciones (últimos 30 días)
Leo Daniel A
Leo Daniel A el 30 de Jun. de 2024 a las 11:16
Comentada: Leo Daniel A el 30 de Jun. de 2024 a las 14:48
I need help with a File exchange NREL's Solar Position Algorithm (SPA). I understand the code, but I am new to MATLAB funcitons and I do not know how to extract values from this file exchange to my program. If someone could post a simple main.m example showcasing how to extract the values (for eg. azimuth) into the main.m, it would be helpful.
Thanks in advance.

Respuesta aceptada

Cris LaPierre
Cris LaPierre el 30 de Jun. de 2024 a las 12:59
The function spa has no outputs. It instead prints the results ot the screen. I would modify the function declaration to return the structure created by the function.
Also note that the clear command is unnecessary in a function.
function [spa] = spa()
spa_const
..
end
You could then access the fields in the structure using dot notation. So a simple main.m might be
my_spa = spa;
my_spa.azimuth_astro
  1 comentario
Leo Daniel A
Leo Daniel A el 30 de Jun. de 2024 a las 14:48
Thanks. Like you suggested I modified the code to output the required value and now I am able to get the values.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Solar Power en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by