简体   繁体   English

CSV导入,仅一列(Matlab /八度音阶)

[英]CSV import, only one column (Matlab/Octave)

I have since several days problems with reading my measurement csv files and make some simple calculations. 几天以来,我在读取测量csv文件并进行一些简单计算时遇到了问题。 I hope someone can help me. 我希望有一个人可以帮助我。

My Aim Read CSV data file, as followed: 我的目标读取CSV数据文件,如下所示:

Open with Excel: 用Excel打开:

date: 20140202  time: 083736    Cycles total: 74127 T_zer: 56   T_op1: 90.000       
 Actu state: stoppes !  T1: -23 T2: -12 T3: -32 T4: -65     
*-*                     
324203  0   34724   0   0   0   2
431040  0   0   0   0   0   1
230706  0   0   0   0   0   1
340810  0   0   0   0   0   1
..............
....
.

-->Here 1st question: If I open with editor, I can only see one delimiter, its ";". ->第一个问题:如果使用编辑器打开,则只能看到一个定界符,即“;”。 But there must be two? 但是必须有两个吗? One for row , one for columns? 一排,一排? How can Excel separate it correctly into row and col, if there is only ";" 如果只有“;”,Excel如何将其正确地分为行和列 ?

However... now I tried to csvread this file with octave. 但是...现在,我尝试使用octave将此文件csvread读取。 There I get it into octave, but everything only in one column:/. 在那里,我将它变成八度,但所有内容都只在一列中:/。 For me it would be very comfortable Octave could read it into a 7x X Matrix. 对我来说,Octave可以将其读入7x X Matrix感到非常舒适。 In this case I can handle the data easy. 在这种情况下,我可以轻松处理数据。

Here my Code: 这是我的代码:

clc
clear all
[fname,pname] =uigetfile();

fname;
extra="/";
pname;

b=strcat(pname,extra,fname);

m = csvread(b);

Result: m as double with 4003x1. 结果: m为4003x1的两倍。 4003 is corretct, but everything in one colum:/ 4003是正确的,但是所有内容都在同一列中:/

m =

       0
       0
       0
   454203
   561040
   340706

I tried now to handle this problem up to several days, but no result. 我现在尝试处理此问题长达几天,但没有结果。

Not a Octave expert, but looks like you can use the dlmread function to read a CSV files, it has many parameters which can help you read the file correctly. 不是八度专家,但是看起来您可以使用dlmread函数来读取CSV文件,它具有许多可以帮助您正确读取文件的参数。

  • start reading the data from row X (and not from the start) 开始从X行读取数据(而不是从头开始)
  • only have Y columns 只有Y栏
  • defined the separator between fields 定义字段之间的分隔符

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM