LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 01-29-2011, 03:20 AM   #1
Gavin Harper
Member
 
Registered: Feb 2010
Location: Finland
Distribution: Slackware
Posts: 169

Rep: Reputation: 24
Octave - Load a text file with floating point values into a matrix


I have a .txt file with the format

0.01
0.04
0.07
...
0.83

I am wanting to load this into octave and perform operations on the data.

I am encountering these errors.

octave:1> load samples.txt
error: load: failed to read matrix from file `samples.txt'
octave:1> load -ascii samples.txt
error: load: failed to read matrix from file `samples.txt'
octave:1> load -text samples.txt
error: load: empty name keyword or no data found in file `samples.txt'
octave:1> load -text "samples.txt"
error: load: empty name keyword or no data found in file `samples.txt'
octave:1>


Any advice would be appreciated!
 
Old 01-29-2011, 03:56 AM   #2
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
If there's a text header, the file won't load. If you have more than two fields at any point in the file, it won't load. The input file has to have the same number of columns (and each column must have the same number of rows), otherwise octave/matlab will complain about the data. That's where I'd start to look.
 
Old 01-30-2011, 12:23 AM   #3
Gavin Harper
Member
 
Registered: Feb 2010
Location: Finland
Distribution: Slackware
Posts: 169

Original Poster
Rep: Reputation: 24
Thank you!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Octave (v3.2): initialize vector/matrix without screen output crts Linux - Software 2 10-23-2010 08:37 AM
LXer: Floating Point Math in Bash, Part 2 (Wait for System Load) LXer Syndicated Linux News 0 08-12-2008 03:10 AM
[C] writing floating point to file- coma instead of dot slomek Programming 4 04-12-2007 03:23 PM
converting a floating point matrix in an grayvalue Image; how? schatoor Programming 6 04-17-2005 06:56 PM
how to use expr to print floating point values max_rsr Linux - Newbie 1 03-12-2005 10:00 PM


All times are GMT -5. The time now is 07:35 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration