Extracting data from excel and rewrite it into specific cell in a loop
Show older comments
Hello all, im new to matlab and wondering how do you extra the data from excel and rewrite it into specific cells format as shown below.
into this format below
2 Comments
Fangjun Jiang
on 24 Sep 2018
No idea what is the relationship between these two sets of data.
LIM JIAXIN
on 24 Sep 2018
Answers (1)
Bob Thompson
on 24 Sep 2018
0 votes
The basic method for extracting data from Excel into Matlab is to use the xlsread() command. I would suggest reading all of the data you are interested in first, and then organizing the data within Matlab. At that point, moving the data is simply a matter of indexing and loops or condition statements.
3 Comments
LIM JIAXIN
on 24 Sep 2018
Bob Thompson
on 24 Sep 2018
Indexing is fairly simple. The super basics in two sentences is to use some form of brackets attached as a suffix to the array variable. Inside the brackets you need to have indicators for which element in which direction you want (i.e. first is row, second is column, then third dimension, fourth dimension, etc.).
data(1,3) % Element it first row, third column of array
data{1,3} % Element CONTENTS in first row, third column of cell array.
For your case you might be looking to do something like this:
rawdata = xlsread(filename,sheet,range);
data(2,1) = rawdata(2,8); % H2 to M1
LIM JIAXIN
on 25 Sep 2018
Categories
Find more on Data Import from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!