Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
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 Kommentare
Jan
Jan am 7 Mai 2013
Ok. And what is the problem? What did you try and which error(s) occurred?
mmenvo
mmenvo am 8 Mai 2013
A typical F is like this : "FILE: r1200i000-0ln140410.LID d=0.01 m = 1.200 - .000E+00 i"

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Cell Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by