Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
I have to compare data from matrix with different dimensions
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi everyone,
I have to compare the data of two matrix with different dimensions but without 'intersect' because I need every data. I tried to do a for loop and if condition but I obtaine the error 'Matrix dimension must agree'. Is there someone that can help me? I'm attacching my code below. Thanks.
format long g
folderData = 'D:\Valerio\data\ACCESS1.0';
filePattern = fullfile(folderData, '*.xlsx');
xlsFiles = dir(filePattern);
nFiles = length(xlsFiles);
for ii = 1:nFiles
filename = fullfile(xlsFiles(ii).folder, xlsFiles(ii).name);
files{ii} = xlsread(filename);
end
IPCC = files(1);
ERA5 = files(2);
Data_IPCC = IPCC{:,1};
Data_ERA5 = ERA5{:,1};
Years_IPCC = Data_IPCC(:,1);
Years_ERA5 = Data_ERA5(:,1);
range_IPCC = length(Years_IPCC);
range_ERA5 = length(Years_ERA5);
index_year = []
for i = 1:range_IPCC
for j = 1:range_ERA5
if Years_IPCC == Years_ERA5
index_year(i,j) = j
end
end
end
4 Kommentare
dpb
am 12 Mär. 2020
Where's the second dataset and what is the wanted result from the two?
Look at ismember
Antworten (1)
dpb
am 12 Mär. 2020
Convert both to timetable or timeseries objects and use retime to synchronize the two.
7 Kommentare
Guillaume
am 13 Mär. 2020
I'm a bit unclear as to what the desired output is.
There are 64 dates of the ERA files not found in the ACCESS file, and 67 dates of the ACCESS file not found in the ERA files. How should identical be merge? What should be done about the dates not present in one file and not the other?
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!