unable to concatenate the table variables 'dbs_id' and 'dbs_bezeichnung', because their types are double and cell. in matlab

You can convert the double column to a cell column using the num2cell function, and then concatenate the two columns with the horzcat function. Here's an example:

main.m
% create a table with a double column and a cell column
dbs_id = [1; 2; 3];
dbs_bezeichnung = {'A'; 'B'; 'C'};
T = table(dbs_id, dbs_bezeichnung);

% convert the double column to a cell column
dbs_id_cell = num2cell(dbs_id);

% concatenate the two columns
T_concat = horzcat(dbs_id_cell, dbs_bezeichnung);
306 chars
11 lines

In this example, T_concat will be a table with two columns, both cell columns, containing the values of dbs_id and dbs_bezeichnung.

Keep in mind that concatenating columns with different types can cause unexpected behavior in your code, so be sure to check the results carefully.

related categories

gistlibby LogSnag