大家好,又见面了,我是你们的朋友全栈君。
用load函数导入mat文件大家都会。但是今天我拿到一个数据,文件后缀名居然是‘.data’。该怎么读呢?
我只好用matlab界面Workspace区域的“import data”按钮手工导入该文件。恩,还好,居然成功了。顺便提一下,这个“import data”按钮功能很强大,连excel文件都能导入。
但是如果在脚本里如何导入这种非mat文件呢?
这时候就轮到“importdata”函数登场啦!
———————————————————————
importdata
Load data from file
Syntax
importdata(filename)
A = importdata(filename)
A = importdata(filename, delimiter)
A = importdata(filename, delimiter, nheaderlines)
[A, delimiter] = importdata(…)
[A, delimiter, nheaderlines] = importdata(…)
[…] = importdata(‘-pastespecial’, …)
Description
importdata(filename) loads data from filename into the workspace.
A = importdata(filename) loads data into A.
A = importdata(filename, delimiter) interprets delimiter as the column separator in ASCII file filename.
A = importdata(filename, delimiter, nheaderlines) loads data from ASCII file filename, reading numeric data starting from line nheaderlines+1.
[A, delimiter] = importdata(…) returns the detected delimiter character for the input ASCII file.
[A, delimiter, nheaderlines] = importdata(…) returns the detected number of header lines in the input ASCII file.
[…] = importdata(‘-pastespecial’, …) loads data from the system clipboard rather than from a file.
—————————————————————-
这个函数可以支持的文件格式有:MAT文件,ASCII files和Spreadsheets,images, Audio files
这个ASCII files和Spreadsheets指的是:For ASCII files, data contains a double array. Other fields contain cell arrays.
For spreadsheets, each field contains a struct, with one field for each worksheet.
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/127279.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...