Error: Unable to concatenate the table variables 'Animal' and 'Date', because their types are cell and datetime.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I an trying to normalize a data set of values that I have. I am importing an .xlsx file into MATLAB which contains that data set and trying to normalize it using the code given below. When I try to do so, I get an error saying 'Unable to concatenate the table variables 'Animal' and 'Date', because their types are cell and datetime.'. Can you help me fix this error?
clc
close all
normalized_HR = readtable('NewNormalizedHR.xlsx');
%
dex=normalized_HR{1:29,1:1000};
propofol=normalized_HR{30:48,1:1000};
alfax=normalized_HR{49:78,1:1000};
iso=normalized_HR{79:81,1:1000};
chloralose=normalized_HR{82:87,1:1000};
trial_length = 675:1010; %% CHANGE THIS
% ALFAX
alfax_min = min(alfax')';
alfax_max = max(alfax')';
alfax_range = alfax_max-alfax_min;
alfax_renorm = ones(size(alfax,1),size(alfax,2));
alfax_trialnumber = size(alfax,1);
for i = 1:alfax_trialnumber
amin = alfax_min(i);
arange = alfax_range(i);
alfax_renorm(i,:) = (alfax(i,:)-amin*ones(size(trial_length)))./(arange*ones(size(trial_length))); % just first row
end
% CHLORALOSE
chloralose_min = min(chloralose')';
chloralose_max = max(chloralose')';
chloralose_range = chloralose_max-chloralose_min;
chloralose_renorm = ones(size(chloralose,1),size(chloralose,2));
chloralose_trialnumber = size(chloralose,1);
for i = 1:chloralose_trialnumber
amin = chloralose_min(i);
arange = chloralose_range(i);
chloralose_renorm(i,:) = (chloralose(i,:)-amin*ones(size(trial_length)))./(arange*ones(size(trial_length))); % just first row
end
% DEX
dex_min = min(dex')';
dex_max = max(dex')';
dex_range = dex_max-dex_min;
dex_renorm = ones(size(dex,1),size(dex,2));
dex_trialnumber = size(dex,1);
for i = 1:dex_trialnumber
amin = dex_min(i);
arange = dex_range(i);
dex_renorm(i,:) = (dex(i,:)-amin*ones(size(trial_length)))./(arange*ones(size(trial_length))); % just first row
end
% ISO
iso_min = min(iso')';
iso_max = max(iso')';
iso_range = iso_max-iso_min;
iso_renorm = ones(size(iso,1),size(iso,2));
iso_trialnumber = size(iso,1);
for i = 1:iso_trialnumber
amin = iso_min(i);
arange = iso_range(i);
iso_renorm(i,:) = (iso(i,:)-amin*ones(size(trial_length)))./(arange*ones(size(trial_length))); % just first row
end
% PROPOFOL
propofol_min = min(propofol')';
propofol_max = max(propofol')';
propofol_range = propofol_max-propofol_min;
propofol_renorm = ones(size(propofol,1),size(propofol,2));
propofol_trialnumber = size(propofol,1);
for i = 1:propofol_trialnumber
amin = propofol_min(i);
arange = propofol_range(i);
propofol_renorm(i,:) = (propofol(i,:)-amin*ones(size(trial_length)))./(arange*ones(size(trial_length))); % just first row
end
% MEANS ALONE
figure
plot(trial_length,mean(alfax_renorm),'Color','[0.89 0.10 0.11]','LineWidth' ,2);
hold on
plot(trial_length,mean(chloralose_renorm),'Color','[0.22 0.49 0.72]','LineWidth',2);
hold on
plot(trial_length,mean(dex_renorm),'Color','[0.30 0.69 0.29]','LineWidth',2);
hold on
plot(trial_length,mean(iso_renorm),'Color','[0.60 0.31 0.64]','LineWidth',2);
hold on
plot(trial_length,mean(propofol_renorm),'Color','[1 0.5 0]','LineWidth',2);
legend({'alfaxalone','alpha-chloralose','dexmedetomidine','isoflurane','propofol'}, 'fontsize', 14)
title('Normalized agent-averaged cystometry curves')
xlabel('time (normalized)')
ylabel('pressure (normalized)')
%MEANS
figure
%% START MEANS
hold on
plot(trial_length,mean(alfax_renorm),'Color','[0.89 0.10 0.11]' , 'LineWidth',2);
hold on
plot(trial_length,mean(chloralose_renorm),'Color','[0.22 0.49 0.72]', 'LineWidth',2);
hold on
plot(trial_length,mean(dex_renorm),'Color','[0.30 0.69 0.29]', 'LineWidth',2);
hold on
plot(trial_length,mean(iso_renorm),'Color','[0.60 0.31 0.64]', 'LineWidth',2);
hold on
plot(trial_length,mean(propofol_renorm),'Color','[1 0.5 0]', 'LineWidth',2);
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Creating and Concatenating Matrices 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!