excel—write

利用Matlab將數據寫入excel文件中:

連接:https://ww2.mathworks.cn/help/matlab/ref/writetable.htmlhtml

   

  函數:writeable;writeable;writematrix;xlswrite(不推薦)函數

  語法:spa

writeable
writeable
writematrix
writetable(T)
writetable(T,filename)
writetable(___,Name,Value)
writecell(C)
writecell(C,filename)
writecell(___,Name,Value)
writematrix(A)
writematrix(A,filename)
writematrix(___,Name,Value)

 

 

 

 

 

 

1、將表寫入到電子表格中特定的工做表和範圍

  writetable(T,'myData.xls','Sheet',1,'Range','B2:F6')excel

  注意:T的數據類型是cellcode

  matlab 數據轉換:
htm

  • cell2mat:將cell轉換爲mat的char型
  • str2num:將mat從char轉換爲double型
  • cellstr:將char轉cell
  • num2str:將double轉char
  • num2cell:將double直接轉cell
%獲取文件夾下全部jpg文件的名稱,而後寫入excel文件 %獲取文件名稱 filepath = 'D:\Users\zhuyingdi\Desktop\表彰\*.jpg'; fileinfo = dir(filepath);%獲取文件的全部信息 len = length(fileinfo); write_filename = '11.xls'; for i = 1:len T = fileinfo(i).name; C = cellstr(T); i1 = num2str(i); cell = strcat('A',i1); writecell(C,write_filename,'Sheet',1,'Range',cell); end
相關文章
相關標籤/搜索