How to extract cell arrays (dates) from a cell array

24 vues (au cours des 30 derniers jours)
Laura Alvarez Salinas
Laura Alvarez Salinas le 3 Sep 2021
I have a cell array which I want to make a matrix and create graphs from. I've done something similar before and it worked but since my matlab updated to the new one, I can't recreate my results and have come across the same problem in another data extraction.
Okay so this is my code:
%the following lines will read the excel tables into matlab so that they
%are compatible
Therm1 = readtable('Thermister data.xlsx');
%convert datafrom a table to cell and then a numeric array
thermister1 = table2cell(Therm1);
thermister2 = cell2mat(thermister1);
These issues pop up:
% Error using cell2mat (line 45)
% All contents of the input cell array must be of the same data type.
% Error in Thermisters (line 19)
% thermister2 = cell2mat (thermister1);
once my table is in a cell array it looks more like this:
I've tried making columns 2-6 a matriz seperately and it worked, but I can't get the date and time to be extracted into a matrix because each individual date is in it's own 1x1 cell array. How can I fix this issue?
  1 commentaire
the cyclist
the cyclist le 3 Sep 2021
It would be much easier for us to help if you upload your data file (or a small subset that exhibits the issue), so that we can exactly replicate that problem.

Connectez-vous pour commenter.

Réponses (1)

Joel Van Sickel
Joel Van Sickel le 3 Sep 2021
Hello Laura,
please try this:
temp = Therm1{:,1}
Regards,
Joel
  1 commentaire
Laura Alvarez Salinas
Laura Alvarez Salinas le 3 Sep 2021
Hello Joel,
Thank you so much! It worked!
Sincerely,
Laura

Connectez-vous pour commenter.

Catégories

En savoir plus sur Data Type Identification dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by