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.
  댓글 수: 2
Jan
Jan 2013년 5월 7일
Ok. And what is the problem? What did you try and which error(s) occurred?
mmenvo
mmenvo 2013년 5월 8일
A typical F is like this : "FILE: r1200i000-0ln140410.LID d=0.01 m = 1.200 - .000E+00 i"

댓글을 달려면 로그인하십시오.

답변 (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