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

1 回表示 (過去 30 日間)
mmenvo
mmenvo 2013 年 5 月 7 日
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 Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by