数据的导入和导出
2021-6-1
| 2023-8-2
0  |  阅读时长 0 分钟
type
status
date
slug
summary
tags
category
icon
password
Property

 
MATLAB支持的文件类型如下:
文件内容
扩展名
读取文件的函数
写入文件的函数
MATLAB数据
*.mat
load
save
Excel表格
*.xls*.xlsx
xlsread
xlswrite
空格分隔的数字
*.txt
load
save

读写MATLAB格式的数据

MATLAB工作区内的数据可以以*.mat格式保存在文件中.使用save函数将数据存入文件,使用load函数从文件中读取数据.
notion image
  • save函数的语法如下:
    • save(filename,variables)将变量variables以二进制形式存入文件中.
    • save(filename,variables,'-ascii')将变量variables以文本形式存入文件中.
  • load函数的语法如下:
    • load(filename)从二进制形式文件中读取数据.
    • load(filename,'-ascii')从文本形式文件中读取数据.
其中参数filenamevariables都是字符串格式,若不指定variables参数,则将当前工作区内所有变量存入文件中.
复杂的数据格式,如structcell,不支持以二进制格式存储
 
 

读写Excel表格

使用xlsreadxlswrite函数可以读写Excel数据,语法如下:
  • 读取Excel文件的语法:[num,txt,raw] = xlsread(filename,sheet,xlRange)
    • notion image
  • 写入Excel的语法:xlswrite(filename,A,sheet,xlRange)
    •  
       
notion image
notion image
notion image
notion image
 
 
 
 
  • Matlab
  • 数值的微分和积分多项式的微分和积分
    目录