How to insert strings and numeric values together in the same matrix in Matlab?

1 次查看(过去 30 天)
I want to insert string characters(first column of my excel file) and numeric values(2nd to 11th column) in the same matrix in matlab, in order to perform row-wise random shuffling of the data. My data are in matrix of 314258 rows and 11 columns.
I've tried as follows:
if true
[num txt str] = xlsread('Training data (410-500) nm.xlsx','A2:A314259');
EX_355 = xlsread('Training data (410-500) nm.xlsx','B2:B314259');
EX_532 = xlsread('Training data (410-500) nm.xlsx','D2:D314259');
BA_355 = xlsread('Training data (410-500) nm.xlsx','C2:C314259');
BA_532 = xlsread('Training data (410-500) nm.xlsx','E2:E314259');
BA_1064 = xlsread('Training data (410-500) nm.xlsx','F2:F314259');
real = xlsread('Training data (410-500) nm.xlsx','I2:I314259');
imaginary = xlsread('Training data (410-500) nm.xlsx','J2:J314259');
modewidth = xlsread('Training data (410-500) nm.xlsx','G2:G314259');
nm = xlsread('Training data (410-500) nm.xlsx','H2:H314259');
Reff = xlsread('Training data (410-500) nm.xlsx','K2:K314259');
F = str;
Input(1,:) = F;
Input(2,:) = EX_355;
Input(3,:) = EX_532;
Input(4,:) = BA_355;
Input(5,:) = BA_532;
Input(6,:) = BA_1064;
Input(7,:) = real;
Input(8,:) = imaginary;
Input(9,:) = modewidth;
Input(10,:) = nm;
Input(11,:) = Reff;
end
Matlab cannot insert F into the Input matrix and shows error - "Conversion to cell from double is not possible".
How can i insert both of them (strings and numerics)in the same matrix. I need to insert them in a same matrix so that i can perform random shuffling of data row-wise.
Thanks for any help.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by