楼主: ruczhaojie
4874 8

[问答] 将D盘中的Csv文件导入到matlab中的程序 [推广有奖]

  • 0关注
  • 0粉丝

已卖:8份资源

硕士生

5%

还不是VIP/贵宾

-

威望
0
论坛币
2455 个
通用积分
5.4000
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
7759 点
帖子
20
精华
0
在线时间
227 小时
注册时间
2011-3-24
最后登录
2025-6-26

楼主
ruczhaojie 发表于 2013-3-15 14:37:56 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
求大神帮我看看,这个该怎么写,小弟没怎么接触过Matlab,今日急需!先谢过!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:MATLAB matla atlab Lab Atl 程序 matlab

沙发
yuanxinqiang 发表于 2013-3-15 14:56:39
你去看下exlink工具箱文档。excel加载EXLINK项后,可以直接将数据发送给MATLAB。
当然你也可以以读取数据库的方式,让MATLAB读取。具体看下database工具箱文档。

藤椅
ruczhaojie 发表于 2013-3-15 14:59:06
yuanxinqiang 发表于 2013-3-15 14:56
你去看下exlink工具箱文档。excel加载EXLINK项后,可以直接将数据发送给MATLAB。
当然你也可以以读取数据库 ...
嗯,能告诉我直接将Csv文件导进去的程序语言么?导进去后的结果不重要,关键是要走这么个程序

板凳
yuanxinqiang 发表于 2013-3-15 15:02:57
ruczhaojie 发表于 2013-3-15 14:59
嗯,能告诉我直接将Csv文件导进去的程序语言么?导进去后的结果不重要,关键是要走这么个程序
这个要看文档。我也记不住这么多具体代码。

报纸
yuanxinqiang 发表于 2013-3-15 15:11:17
  % Create data for use in the examples that follow:
    values = {1, 2, 3 ; 4, 5, 'x' ; 7, 8, 9};
    headers = {'First', 'Second', 'Third'};
    xlswrite('myExample.xls', [headers; values]);
    moreValues = rand(5);
    xlswrite('myExample.xls', moreValues, 'MySheet');

    % Read data from the first worksheet into a numeric array:
    A = xlsread('myExample.xls')

地板
ruczhaojie 发表于 2013-3-15 15:12:09
yuanxinqiang 发表于 2013-3-15 15:02
这个要看文档。我也记不住这么多具体代码。
那用菜单导入数据,Matlab会像SAS一样自动产生程序么?

7
yuanxinqiang 发表于 2013-3-15 15:12:10
ruczhaojie 发表于 2013-3-15 14:59
嗯,能告诉我直接将Csv文件导进去的程序语言么?导进去后的结果不重要,关键是要走这么个程序
help xlsread看详细帮助信息

8
yuanxinqiang 发表于 2013-3-15 15:13:29
ruczhaojie 发表于 2013-3-15 15:12
那用菜单导入数据,Matlab会像SAS一样自动产生程序么?
可以产生:脚本和函数两种情况

9
matlab-007 发表于 2014-11-20 10:28:25
先说一下字符串,字符串在matlab中需要加单引号,你直接使用newData1 = importdata(DOW.txt);
matlab便会将DOW.txt看成是变量,但是importdata需要一个包含文件名的字符串变量,但是DOW.txt不知道是什么东西,所以会出现??? Undefined variable "DOW" or class "DOW.txt".

正确的使用方法是:
newData1 = importdata('DOW.txt');
或者
path='DOW.txt'
newData1 = importdata(path);

不过importdata不支持后缀名为txt文件,其支持的文件后缀有:
Data formats                     Command    Returns
    MAT  - MATLAB workspace         load       Variables in file.
    CSV  - Comma separated numbers  csvread    Double array.
    DAT  - Formatted text           importdata Double array.
    DLM  - Delimited text           dlmread    Double array.
    TAB  - Tab separated text       dlmread    Double array.

   Spreadsheet formats
    XLS  - Excel worksheet          xlsread    Double array and cell array.
    WK1  - Lotus 123 worksheet      wk1read    Double array and cell array.

   Scientific data formats
    CDF  - Common Data Format               cdfread    Cell array of CDF records
    FITS - Flexible Image Transport System  fitsread   Primary or extension table data
    HDF  - Hierarchical Data Format         hdfread    HDF or HDF-EOS data set

   Movie formats
    AVI  - Movie                    aviread    MATLAB movie.

   Image formats
    TIFF - TIFF image               imread     Truecolor, grayscale or indexed image(s).
    PNG  - PNG image                imread     Truecolor, grayscale or indexed image.
    HDF  - HDF image                imread     Truecolor or indexed image(s).
    BMP  - BMP image                imread     Truecolor or indexed image.
    JPEG - JPEG image               imread     Truecolor or grayscale image.
    GIF  - GIF image                imread     Indexed image.
    PCX  - PCX image                imread     Indexed image.
    XWD  - XWD image                imread     Indexed image.
    CUR  - Cursor image             imread     Indexed image.
    ICO  - Icon image               imread     Indexed image.
    RAS  - Sun raster image         imread     Truecolor or indexed.
    PBM  - PBM image                imread     Grayscale image.
    PGM  - PGM image                imread     Grayscale image.
    PPM  - PPM image                imread     Truecolor image.
  
   Audio formats
    AU   - NeXT/Sun sound           auread     Sound data and sample rate.
    SND  - NeXT/Sun sound           auread     Sound data and sample rate.
    WAV  - Microsoft Wave sound     wavread    Sound data and sample rate.

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-30 03:16