File Exchange

image thumbnail

Weather xls to TMY2

version (1.9 MB) by Muhammad Tauha Ali
This program converts data defined in a particular format in an excel file to TMY2 data format


Updated 24 Jun 2015

View License

The program converts measured data comprising of temperature, RH, GHI, DHI, DNI, wind speed and wind direction into TMY2 format. The TMY2 fields comprising of Illuminance components, atmospheric pressure, precipitable water and broad-band aerosol optical depth are modeled based on tested models available in open literature. Their references are provided in the m-file.
The zip file contains:
1. converter m-file
2. sample data excel files present in yearly and monthly folder
3. TMY2 output from the m-file for the yearly data

Details about TMY2 format can be found at:

The TMY2 data generated by the m-file can then be converted into .epw and .csv using energy plus weather utility and then to .bin using eQuest weather processor available at

I have tried to comment the m-file so that the user can understand and be able modify it.

Comments and Ratings (6)

hello, i can't get this app to work, plz help me

sanat patro

the data are not provided in the book
Tamer khatib

Hi everybody. Can anyone leave instruction of how to use the code, because Im not an expert in MatLAB and cannot figure it out how to introdcue the path and foldername. Please help me



does anybody ha any idea about data source book used in Modeling of Photovoltaic Systems Using MATLAB® - Simplified Green Codes - Tamer Khatib, Wilfried Elmenreich (Wiley, 20161)
please let me know


I'm trying to use your m-file but when I try to Run it, it just gives me an error stating "Undefined function or variable 'foldername'."

Any advice?




Included the ability to pass yearly or monthly files. The code can be easily modified to generate minute based, daily or weekly TMY records if desired by some modifications in the main function of converterweather_ver2.m.

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.

Learn About Live Editor