'Unable to concatenate the table variables 'Var1' and 'Var2', because their types are cell and double.' why this error is showing?
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
clear all;
clc;
%read X sample
ix1 = readtable("x_sample_01.dat",'ReadVariableNames',false);
x1 = table2array(ix1);
0 Kommentare
Antworten (1)
Walter Roberson
am 18 Mär. 2023
Your file contains a mix of text and numeric. What result are you expecting when you ask to convert it to a single array?
6 Kommentare
Walter Roberson
am 25 Aug. 2023
The case where there are empty columns get converted to doubles and filled with NaN -- no problem with table2array()
headerlines = {'Var1', 'Var2'};
Var1 = cell(2,1);
Var2 = [11; 22];
top = headerlines;
bottom = [Var1, num2cell(Var2)];
C = [top; bottom]
writecell(C, 'temp_table.xlsx');
ix1 = readtable('temp_table.xlsx')
x1 = table2array(ix1)
writecell(C, 'temp_table.csv');
dbtype temp_table.csv
Siehe auch
Kategorien
Mehr zu Text Files finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!