Can't concatenate table variables?
    7 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Susan Santiago
 am 3 Dez. 2018
  
    
    
    
    
    Kommentiert: Walter Roberson
      
      
 am 4 Dez. 2018
            I'm importing data using the loop below. I'm getting an error that some of the table variables cannot be concatenated because they're a cell in one table and a noncell in another. How an I correct this? The reason for this issue is because in some data files the variable has actual values and for some parts of the files, the data appears as an NaN. Any help would be appreciated
FileID = dir('*.dat');
T = table;
for j=1:length(FileID)  
    opts = detectImportOptions(FileID(j).name);
    Ts = readtable(FileID(j).name,opts,'ReadVariableNames',false);
    Ts.Properties.VariableNames=VarNames;
    T = [T;Ts];
end
0 Kommentare
Akzeptierte Antwort
  Walter Roberson
      
      
 am 3 Dez. 2018
        Do the detection once against a file that has numeric in that column and use those options for all of the files.
Alternatively after the option detection bash the setting for that column to make the variable numeric with the appropriate nan detection .
3 Kommentare
  Walter Roberson
      
      
 am 4 Dez. 2018
				FileID = dir('*.dat');
T = table;
opts = detectImportOptions(FileID(1).name);
for j=1:length(FileID)  
    Ts = readtable(FileID(j).name,opts,'ReadVariableNames',false);
    Ts.Properties.VariableNames=VarNames;
    T = [T;Ts];
end
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Logical 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!

