How can I do the average difference of two dataset?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
Voss
am 6 Mai 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!