Sometime when a column or a row of data is too long, you can't copy it from MATLAB and then paste directly into an Excel file. A much simpler way to do this is to use the xlswrite function. Just add a line at the end of your code:
xlswrite ('FileName.xls', VariableName)
If you want to put the data into sheet2 in the file, one more input argument is needed:
xlswrite ('FileName.xls', VariableName, 2)
Pretty easy, right?
MATLAB applications, tutorials, examples, tricks, resources,...and a little bit of everything I learned ...
Subscribe to:
Post Comments (Atom)
my-alpine and docker-compose.yml
``` version: '1' services: man: build: . image: my-alpine:latest ``` Dockerfile: ``` FROM alpine:latest ENV PYTH...
-
It took me a while to figure out how to insert a space in Mathtype equations. This is especially useful when you write an equation with mult...
-
Recently I read post from Dr. Doug Hull's blog: http://blogs.mathworks.com/videos/2009/10/23/basics-volume-visualization-19-defining-s...
-
To get the slope of a pair of x and y, usually I first plot the curve and then add the trend line. Actually there are two functions i...
Thanks for your comment, Anonymous!
ReplyDeletehey do u know how to create a for loop and export to different filenames each time the for loop is repeated?
ReplyDeleteis the following goin to work?
for i =1
xlswrite(i.xlsx)
end
I think you use the for loop to repeatedly write/save/export xlsx files. However, you need to pay a little more attention to the file name.
ReplyDeleteThe (i.xlsx) won't work since i is an integer, not a string.
Hello, I am dealing with large quantity of data with the number of rows exceeding Excel's 65526 row limit. I need to export the data into an Excel spreadsheet.
ReplyDeleteI want to write a Matlab code which would break down my data into 65526 rows and save them each as a different variable and then save each variable in a new sheet.
But I am stuck at defining the row range! Could I set my row range as a variable such as this??
---------------------------------------------
matlab_row=size(t0,1);
excel_row=65526;
diff=matlab_row - excel_row;
size1=matlab_row-65000;
page1=t0(1:size1,:);
if diff<0
data1=XLSWRITE('C:\data1.xls',page1,'Sheet1');
------------------
I am new with VBA programming, all help is appreciated.
Thanks
*** I am new with ***C/C++ programming
Deletelets say i want to add 2 vectors....one x and other say y=sin(x) where both x and y are vectors..in to the same excel sheet so that i can create plots of the y vs x kind...so what would i have to change in the command that you have given?
ReplyDeletei got it... first do x=x'; and y =y'; so as to make x and y column vectors. then create a matrix z= [x y]; and then the command becomes
Deletexlswrite('xyz.xls',z,Sheet1,'F5'); that takes care of both the vectors otherwise u have to type out the command twice for each of them (x & y).
how can i adjust the column width of the cells i write into using xlswrite?
ReplyDeletegive more descriptive answers with examples
ReplyDelete