Search this blog!

Thursday, February 16, 2012

How to append in a excel file using Matlab?

Imagine that I have the following excel file called "algoperformace.xls"


algoName mode 95percentile max mean
Algorithm1 13.15153679 20.03323188 39.52043729 15.65858


Now, I would like to add a new line as the following into this excel file using matlab


Neighbor 2.721678458 5.536962451 26.63633753 3.858783


How to do that?
----------------------------------------------------------------------------------
Answer:
%% Loading the excel into matlab

[~, ~, alldata] = xlsread('algperformace.xls');
% We will add new entry line into 'alldata' variable and then will write the excel file
% The script will compute the value for algoname, mode, color_diff_95_percentile, max, mean
% adding those values into the cell of 'alldata'
alldata(size(alldata,1),:)={algoname, mode, color_diff_95_percentile, max, mean};
%writing the complete new 'alldata' into the same excel file
xlswrite('algperformace.xls', alldata);

Try your own example :)


No comments:

Post a Comment