How can I do the average difference of two dataset?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Rahul Shah
el 6 de Mayo de 2022
Comentada: Voss
el 6 de Mayo de 2022
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 comentarios
Respuesta aceptada
Voss
el 6 de Mayo de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!