It means notexistent values give 0, letters NA.
Is there a way that i get always "NA" instead of "0.0" ? (Otherwise I have to do some matrix rearrangements which are not as trivial as they seem to be; they are also time consuming if the array is large)
-------- Original Message --------
Subject: Re: Importing columns as a matrix
Local Time: June 2, 2017 1:54 AM
UTC Time: June 1, 2017 11:54 PM
To: "Niedermayr, Arthur" <address@hidden>
On Fri, Jun 2, 2017 at 12:56 AM, "Niedermayr, Arthur"
> Hello everybody,
> I basically want to import with GNU Octave a matrix of numbers.
> It consists of 132651 values which equals 51x51x51 (later I want to reshape
> my matrix with
> The problem is the format of my data file that I want to import:
> it consists of 6 columns like the following example shows:
> 1.value 2.value 3.value 4.value 5.value 6.value
> 132649.value 132650.value 132651.value no-value no-value no-value
> So the last 3 values of my 6 x 22109 array are empty (6x22109-3=132651). If
> they would be ignored everything would be perfect.
> My data-import command is the following:
> my_textfile=load ("-ascii", "6-columns.txt");
> But due to the fact that 3 values are missing, I get the following error:
> error: load: 6-columns.txt: inconsistent number of columns near line 22109
> Is there a simple workaround for that?
> Every help is really appreciated! Thank you in advance!
> Best regards
> Arthur Niedermayr
> Help-octave mailing list
The simplest hack is to erase the last line of your data and add it
later manually. You could also use dlmread and read all except the
last row or to insert NA in the missing values.
1. first hack
sed '$ d' 6-columns.txt > 6-columns_new.txt
x = dlmread ("6-columns.txt", " ", [0 0 22107 5])
dlmread can also put empty value son those missing ones
x = dlmread ("6-columns.txt", " ", "emptyvalue", NA)
the last row of x will be
132649.value 132650.value 132651.value NA NA NA