csvread Problem on Octave 3.8.0 Mac OS X Yosemite

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

csvread Problem on Octave 3.8.0 Mac OS X Yosemite

jennawebb
Let me start off by saying that I am new to using a Mac, and relatively new to using Octave. The problem I am having involves the csvread function. I just want to test whether certain Octave scripts that work on Windows machines also work on Macs.

I have a script that uses the csvread function, with the file saved as a CSV for the Mac. Here is what the code for that looks like:

    data = csvread('normaldata.csv');

For reference, the normaldata.csv file (the link is to a file that is saved as a Windows csv, but I am sure that it is saved as a Mac CSV when I am using that machine) is a 16x12 matrix, with numerical values only. When this data is read in, for some reason it is represented as a complex number, and it is only a row matrix (1x177) instead of a 16x12 (and the dimensions don't match up). Another thing I just noticed is that some of the entries in the CSV file actually show up in the imaginary part of the complex number. Each number in column 12 (the last column) includes the next entry (column 1, next row) in the imaginary part. For example, row1,col12 entry is 5.18 and row2,col1 entry is 3.7. In the matrix that is read in using csvread, instead of 5.18 being read in as simply the number 5.18, it is read in as 5.18 + 3.7i.


I'm wanting to use this matrix to split each column into separate arrays, but since it is reading it in as one line I cannot do that. I'm sorry if this is confusing, I can include parts of the files and possibly pictures if need be.

Thanks in advance for any help that can be offered.

Jenna
Reply | Threaded
Open this post in threaded view
|

Re: csvread Problem on Octave 3.8.0 Mac OS X Yosemite

Sebastian Schöps
How did you get Octave (the binary at sourceforge.net is not optimal for Yosemite)? However, your file gets correctly read here on Yosemite using Octave 4.0.
Reply | Threaded
Open this post in threaded view
|

Re: csvread Problem on Octave 3.8.0 Mac OS X Yosemite

Doug Stewart-4
In reply to this post by jennawebb


On Thu, Sep 10, 2015 at 1:56 PM, jennawebb <[hidden email]> wrote:
Let me start off by saying that I am new to using a Mac, and relatively new
to using Octave. The problem I am having involves the csvread function. I
just want to test whether certain Octave scripts that work on Windows
machines also work on Macs.

I have a script that uses the csvread function, with the file saved as a CSV
for the Mac. Here is what the code for that looks like:

    data = csvread('normaldata.csv');

For reference, the  normaldata.csv
<http://octave.1599824.n4.nabble.com/file/n4672513/normaldata.csv>   file
(the link is to a file that is saved as a Windows csv, but I am sure that it
is saved as a Mac CSV when I am using that machine) is a 16x12 matrix, with
numerical values only. When this data is read in, for some reason it is
represented as a complex number, and it is only a row matrix (1x177) instead
of a 16x12 (and the dimensions don't match up). Another thing I just noticed
is that some of the entries in the CSV file actually show up in the
imaginary part of the complex number. Each number in column 12 (the last
column) includes the next entry (column 1, next row) in the imaginary part.
For example, row1,col12 entry is 5.18 and row2,col1 entry is 3.7. In the
matrix that is read in using csvread, instead of 5.18 being read in as
simply the number 5.18, it is read in as 5.18 + 3.7i.


I'm wanting to use this matrix to split each column into separate arrays,
but since it is reading it in as one line I cannot do that. I'm sorry if
this is confusing, I can include parts of the files and possibly pictures if
need be.

Thanks in advance for any help that can be offered.

Jenna




try
data1=load("normaldata.csv")
 

--
View this message in context: http://octave.1599824.n4.nabble.com/csvread-Problem-on-Octave-3-8-0-Mac-OS-X-Yosemite-tp4672513.html
Sent from the Octave - General mailing list archive at Nabble.com.

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave



--
DASCertificate for 206392


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: csvread Problem on Octave 3.8.0 Mac OS X Yosemite

jennawebb
In reply to this post by Sebastian Schöps
Thank you for responding so quickly! I am using a work laptop, and Octave was already installed on it so I do not know how it was installed, unfortunately. Silly question, but is Octave 4.0 available for Macs yet? My first thought was to try to update Octave, but when I went to the wiki on how to install it, it didn't seem to say anything about Octave 4.0.
Reply | Threaded
Open this post in threaded view
|

Re: csvread Problem on Octave 3.8.0 Mac OS X Yosemite

jennawebb
In reply to this post by Doug Stewart-4
Hi Doug, thanks for the quick response. I will definitely try this when I get into work next week. I'll update if it works or not. Thanks!