文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > IT/计算机 > matlab导出数据到xls
侵权投诉

matlab导出数据到xls

matlab如何导出数据到excel文件,数学建模常用

, header);
end;




%Add column names
if nargin>2 & ~isempty(colnames)
nhr = nhr + 1; %One extra column name
ncolnames = length(colnames);
for ii=1:ncolnames
colname = localComputLastCol('A',ii);
% cellname = [char(double('A')+ii-1) num2str(nhr+1)];
cellname = [colname num2str(nhr)];
ActivesheetRange = get(Activesheet,'Range',cellname,cellname);
set(ActivesheetRange, 'Value', colnames{ii});
end;
end;




% Put a MATLAB array into Excel.
FirstRow = nhr+1; %You can change the first data row here.
% I start right after the headers
LastRow = FirstRow+nr-1;
FirstCol = 'A'; %You can change the first column here
LastCol = localComputLastCol(FirstCol,nc);
ActivesheetRange = get(Activesheet,'Range',...
[FirstCol num2str(FirstRow)],[LastCol num2str(LastRow)]);
set(ActivesheetRange, 'Value', m);


% If user specified a filename, save the file and quit Excel
if nargin==4
invoke(Workbook, 'SaveAs', [pwd filesep filename]);
invoke(Excel, 'Quit');


[pathstr,name,ext] = fileparts(filename);
disp(['Excel file ' name '.xls has been created.']);
end;


%Delete the ActiveX object
delete(Excel)





function LastCol = localComputLastCol(FirstCol,nc);
% Comput the name of the last column where we will place data
%Input
% FirstCol (string) name of first column
% nc total number of columns to write


%Excel's columns are named:
% A B C ... A AA AB AC AD .... BA BB BC ...
FirstColOffset = double(FirstCol) - double('A'); %Offset from column A
if nc<=26-FirstColOffset %Easy if single letter
%Just convert to ASCII code,add the number of needed columns,and convert back
%to a string
LastCol = char(double(FirstCol)+nc-1);
else
ng = ceil(nc/26); %Number of groups (of 26)
rm = rem(nc,26)+FirstColOffset; %How many extra in this group beyond A
LastColFirstLetter = char(double('A') + ng-2);
LastColSecondLetter = char(double('A') + rm-1);
LastCol = [LastColFirstLetter LastColSecondLetter];
end;

上一页第2页

你可能喜欢

热门文档

相关文档

  • matlab数据导出到excel

    matlab数据导出到excel_理学_高等教育_教育专区。matlab数据导出到excel你可以直接在m文件里面用xlswrite函数:(filename/sheet/range都是要加单引号滴) xlswrite(...

  • matlab导出数据(fprintf,dlmwrite,xlswrite)

    matlab导出数据(fprintf,dlmwrite,xlswrite)_电脑基础知识_IT/计算机_专业资料...在图像数组的输出到文件的操作上,我发现 fprintf 比 dlmwrite 明显 快很多,但...

  • matlab与excel数据导入导出

    matlab与excel数据导入导出_计算机软件及应用_IT/计算机_专业资料。相互切换无...可以利用数据导入向导把 Excel 文件中的数据导入到 MATLAB 工作空间,步骤与 6....

  • matlab导出数据的方法讲义

    matlab导出数据的方法讲义_理学_高等教育_教育专区。如何用matlab导出数据matlab 导出数据(fprintf,dlmwrite,xlswrite 函数) 1.用 fprintf 函数写数据到 txt,xls ...

  • matlab数据导入和导出

    matlab数据导入和导出_工学_高等教育_教育专区。MATLAB导入文本文件 文本文件需要... 'E1')将单元格数组 d 的数据写出至 tempdata.xls 文件,新建工作表'...

  • Matlab中数据的导入与导出

    Matlab 中数据的导入与导出 把 excel 中的数据导入 matlab 中的矩阵 a a=xlsread(‘路径\文件名.xls’,sheet,’数据段’) 把 matlab 中的矩阵 b 导出到 ...

  • 将MATLAB数据保存到Excel中的程序

    将MATLAB数据保存到Excel中的程序_理学_高等教育_教育专区。将MATLAB数据保存到... matlab数据导入和导出 3页 免费 matlab与excel xlsread、... 4页 1下载券...

  • matlab中的数据导入和导出

    matlab中的数据导入和导出_IT/计算机_专业资料。matlab 中的数据导入和导出 ... 'E1')将单元格数组 d 的数据写出至 tempdata.xls 文件,新建工作表'...

  • Matlab数据的导入与导出

    Matlab数据的导入与导出_计算机软件及应用_IT/...从Excel文件中读取数据 把数据写入Excel文件 2013-7...数据 明 从文本文件导入数据到 MATLAB 工 打开文件...

  • Matlab数据导入导出方法

    Matlab数据导入导出方法_计算机软件及应用_IT/计算机...('filename'),将 filename 中的数据导入到工作区...文件、word 文件、xml 文件、xls 文件、图像文件和...

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email