Size of the left side
Show older comments
Hello!
I have a piece of code that runs perfectly with 10 climate data csv files (which have the same information) but with different minimum and maximum temperature values. The problem is, I have other 10 climate csv files that keep having the same problem (even though I got it from the same website and the data is the same as my first 10 files). The code is inside a for loop.
The problem says this:

I already looked at the files and they seem correct (compared to the ones that do work). I do not know how to fix it, any ideas?
Thank you!
11 Comments
Walter Roberson
on 25 Sep 2021
Not really enough information for us to debug. All w ecan say is that the variable column came out empty. You need to work backwards to figure out why column is coming out empty.
Mathieu NOE
on 27 Sep 2021
maybe you should share two csv files one 'good' and one 'bad' with the portion of code where you get the error
so we can test on our side
Nuria Andreu
on 3 Oct 2021
Nuria Andreu
on 3 Oct 2021
Walter Roberson
on 4 Oct 2021
Certainly you could
if isempty(column); continue; end
but in that particular case, what values do you want stored in yearly_data_matrix(ind,:) ?
Nuria Andreu
on 4 Oct 2021
Walter Roberson
on 4 Oct 2021
You are building an output matrix named yearly_data_matrix with one row for each year.
What values do you want to store into the rows for the case that the year has no associated data?
Nuria Andreu
on 4 Oct 2021
Walter Roberson
on 4 Oct 2021
I suggest pre-allocating the yearly_data_matrix as nan, and using if isempty(column); continue; end and then after you have constructed it, rmmissing() (though you might want to change that strategy slightly if nan can show up for other reasons.)
Nuria Andreu
on 4 Oct 2021
Nuria Andreu
on 5 Oct 2021
Answers (0)
Categories
Find more on Time Series Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
