Calculating the average every three months
Mostra commenti meno recenti
Hi all, I leaning matlab thru practice and patience, I have the following dataset with sunspot observations for 38 years. I am trying to get the average of months 12,1,2 per year. I was using the code below but I am getting the following error message. " Undefined operator '>=' for input arguments of type 'table'."
Any advise will be greatly appreciated.
IDX=data(:,3) >= 5;
fdata = data(idx,:);
iex = fdata(:,3) <= 7;
fildata = fdata(iex,:);
year = fildata(:,2);
avr = accumarray(year,fildata(:,1))./3;
idx = avr(:,1) > 0;
avr = avr(idx,1);
4 Commenti
Artemio Soto Breceda
il 24 Ott 2019
Would you mind sharing what does the data look like? Run:
>> data(1:10, :)
and put the result here.
Also, what command are you using to load the data? Is it from an Excel file?
desert_scientist90
il 24 Ott 2019
desert_scientist90
il 24 Ott 2019
Artemio Soto Breceda
il 24 Ott 2019
Modificato: Artemio Soto Breceda
il 24 Ott 2019
Ah, thanks. I hadn't seen that you included your xlsx file in the post. See my answer below.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!