How can I do the average difference of two dataset?
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
for date = 1:436
for band = [1 2 3 4 5 7]
L2= L2_p181r040(date).SREF(band).Sur_Ref_L2_MASK;
SM = SM_p181r040(date).SREF(band).Sur_Ref_Mask_Normalized;
if isequal(size(L2),size(SM))
Diffs(date).AbsDiff(band).Ref_Diff = mean(SM-L2);
Band_DIFFs(band).diff(date) = Diffs(date).AbsDiff(band).Ref_Diff;
end
end
end
Hello all, I am getting error - Index exceeds the number of array elements (0).
For some of the dates, I don't have data for L2 variable but have all the dates for SM. I want to calculate the average difference between the two dataset (SM & L2), for only the dates which L2 have, so can you please help in this.
0 Commenti
Risposta accettata
Voss
il 6 Mag 2022
for date = 1:numel(L2_p181r040)
% skip L2_p181r040(date) if L2_p181r040(date).SREF is empty
if isempty(L2_p181r040(date).SREF)
continue
end
% otherwise do the thing
for band = [1 2 3 4 5 7]
L2 = L2_p181r040(date).SREF(band).Sur_Ref_L2_MASK;
SM = SM_p181r040(date).SREF(band).Sur_Ref_Mask_Normalized;
if isequal(size(L2),size(SM))
Diffs(date).AbsDiff(band).Ref_Diff = mean(SM-L2);
Band_DIFFs(band).diff(date) = Diffs(date).AbsDiff(band).Ref_Diff;
end
end
end
6 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!