Azzera filtri
Azzera filtri

Convert from Table to Array

5 visualizzazioni (ultimi 30 giorni)
Sara Nasir
Sara Nasir il 21 Giu 2022
Modificato: Eric Sofen il 24 Giu 2022
I have created a variable ScanIndex which is a table. It also the column names since it is exported from .csv file.
Now I want to convert this table into double, which should ideally be done by table2array.
But I am getting an error : Unable to use a value of type cell as an index.
Here ind2 = 4 because I have four .csv files but that is not the problem.
%% scanindex
z7Bcolnames.scanindex = z7Bcol_names(contains(z7Bcol_names,'ScanIndex'));
dynamicHostData(ind2).ScanIndex(:,z7Bcolnames.scanindex) = z7Bdata(ind2).matfiletable(:,z7Bcolnames.scanindex);
dynamicHostData(ind2).ScanIndex = table2array(dynamicHostData(ind2).ScanIndex(:,1));
  1 Commento
Eric Sofen
Eric Sofen il 24 Giu 2022
Modificato: Eric Sofen il 24 Giu 2022
It would be helpful to have the data and reproductions steps in order to figure out where things are going wrong.
One thing to check: The ScanIndex table variable contains a cell array of tables. Make sure that the thing being passed to table2array is in fact a table and not a cell containing a table. You may need {} indexing at the lowest level to pull out the 869x1 table.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Tables in Help Center e File Exchange

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by