Change data type of a row in a table?
    6 ビュー (過去 30 日間)
  
       古いコメントを表示
    
Ex. Change this table
 1 2 3 4 
 2 1 3 2
to
 '1' '2' '3' '4'
  2   1   3   2
0 件のコメント
採用された回答
  Walter Roberson
      
      
 2018 年 6 月 6 日
        No, that is no possible. In a table() object, all elements of a column must be the same data type.
In order for some entries in a column to be character vectors and some entries to be numeric, you would have to change the column to cell array, ending up with
['1'] ['2'] ['3'] ['4']
[  2] [  1] [  3] [  2]
2 件のコメント
  Walter Roberson
      
      
 2018 年 6 月 6 日
				
      編集済み: Walter Roberson
      
      
 2018 年 6 月 6 日
  
			Each cell array entry can be a different data type.
A = [ 1 2 3 4 
      2 1 3 2 ]
B = num2cell(A);
B(1,:) = sprintfc('%d', A(1,:));
disp(B)
    '1'    '2'    '3'    '4'
    [2]    [1]    [3]    [2]
その他の回答 (0 件)
参考
カテゴリ
				Help Center および File Exchange で Tables についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

