[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Format of mat file
From: |
Ian McCallion |
Subject: |
Re: Format of mat file |
Date: |
Wed, 26 Dec 2018 00:06:04 +0000 |
On Tuesday, 25 December 2018, Rich Lakey <address@hidden> wrote:
just getting started and have
M=csvread('file.csv')
and then
save('file.mat','M')
File looks ok but cannot find description of what it should look like. First few lines:
# Created by Octave 4.2.2, Tue Dec 25 15:27:10 2018 CST <address@hidden>
# name: M
# type: matrix
# rows: 1258
# columns: 1
1833.3199
1842.02
1841.4
1841.0699
The data starts in column 2 or is the first column zero? Should my data be in the fist column? Do I reference data starting in row 1 or 6 after the header info. I'm assuming Octave skips the header info and treats row 6 as 1.
I can't see why you need to know the format of the file. Save data, then load it again when needed.
I also can't see why you have saved and loaded the data at all.
My program seems to run ok but no output. I suspect I am not reading the data from the file. Using a blank file the results are the same, program runs but no output.
The start of my program loads the file as:
% Part 1
load file.mat
At this point type
who
To see the variables present. To see how much data is in a variable M type
size(M)
for i=1:1258
x(i) = i;
end
The above can be replaced by
x = 1:1258;
p1 = polyfit(x', file(1:1258), 3);
I do not know what the 'file' variable is, but your data should be in M.
xx = (1:1:1358)';
pp1 = polyval(p1, xx);
plot(xx, NFLXdata)
hold
I can run commands and get the samples in documentation to work, but I am missing something with inputting data from file.
Rich
Hope this helps. If not I would encourage you to read the manual and try a few more exanples out.
Ian