Vivek Dutta Roy
Vivek Dutta Roy

Reputation: 1

Octave(loading files with multiple NA values)

I have a dataset which has a lot of NA values.I have no idea how to load it into octave.
The problem is whenever i am using data=load("a,txt") it says error: value on the right hand side is undefined

Upvotes: 0

Views: 135

Answers (1)

Michael Ruth
Michael Ruth

Reputation: 3504

First, ensure that you are using data=load("a.txt"); and not data=load("a,txt");

If you want to load all of the data from the file into one matrix then use

data = dlmread("a.txt", "emptyvalue", NA);

This reads in the data from a.txt, inferring the delimiter, and replacing all empty values with NA. The code preserves NaN and Inf values.

If you have multiple data sets in the file you'll need to get creative, and it may be simpler to just use the above code and segment the data sets in Octave.

Upvotes: 1

Related Questions