Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Newbie question from a struggling student...

Subject: Newbie question from a struggling student...

From: Endre Sollid

Date: 17 Nov, 2010 21:27:04

Message: 1 of 20

I am in the middle of an asignement with matlab, whereas i am to arrange two matrixes with 365 days in each, yes you guessed it a yearly statistics of sorts.

I have two sources one is 365 days with air temperature, the other is snow fall, and there lies my problem, that matrix is only 212 columns, and im trying to extend that onto 365 columns without destroying the fact that i have measurements on both ends that need to stay where they are in a way... the last measurement needs to come on spot 365 so to speak, so i need to add zeroes in the middle i reckon since no snow in july, not even in norway...

can anyone explain how to add such things to this matrix of mine?

Subject: Newbie question from a struggling student...

From: Sean de

Date: 17 Nov, 2010 21:49:27

Message: 2 of 20

"Endre Sollid" <stensaker@hotmail.com> wrote in message <ic1hb8$lm8$1@fred.mathworks.com>...
> I am in the middle of an asignement with matlab, whereas i am to arrange two matrixes with 365 days in each, yes you guessed it a yearly statistics of sorts.
>
> I have two sources one is 365 days with air temperature, the other is snow fall, and there lies my problem, that matrix is only 212 columns, and im trying to extend that onto 365 columns without destroying the fact that i have measurements on both ends that need to stay where they are in a way... the last measurement needs to come on spot 365 so to speak, so i need to add zeroes in the middle i reckon since no snow in july, not even in norway...
>
> can anyone explain how to add such things to this matrix of mine?

The generate a list of 212 numbers 1 to 365, of the days corresponding to snow fall that you have. Call it idx

idx = your_212_column_to_be locations; %e.g. [1 2 3... 130, 280... 365]
snow_fall365 = zeros(1,365);
snow_fall365(idx) = snow_fall212;

We don't have snow in July here in Maine either!

Subject: Newbie question from a struggling student...

From: someone

Date: 17 Nov, 2010 21:57:03

Message: 3 of 20

"Endre Sollid" <stensaker@hotmail.com> wrote in message <ic1hb8$lm8$1@fred.mathworks.com>...
> I am in the middle of an asignement with matlab, whereas i am to arrange two matrixes with 365 days in each, yes you guessed it a yearly statistics of sorts.
>
> I have two sources one is 365 days with air temperature, the other is snow fall, and there lies my problem, that matrix is only 212 columns, and im trying to extend that onto 365 columns without destroying the fact that i have measurements on both ends that need to stay where they are in a way... the last measurement needs to come on spot 365 so to speak, so i need to add zeroes in the middle i reckon since no snow in july, not even in norway...
>
> can anyone explain how to add such things to this matrix of mine?

% Something like:

test = [1 2 3 4 5;6 7 8 9 10];
split = 3;
addCols = 4;
new_test = [test(:,1:split) zeros(2,addCols) test(:,split+1:end)]

new_test =

     1 2 3 0 0 0 0 4 5
     6 7 8 0 0 0 0 9 10

Subject: Newbie question from a struggling student...

From: Endre Sollid

Date: 17 Nov, 2010 22:02:04

Message: 4 of 20

"someone" <someone@somewhere.net> wrote in message <ic1j3f$kek$1@fred.mathworks.com>...
> "Endre Sollid" <stensaker@hotmail.com> wrote in message <ic1hb8$lm8$1@fred.mathworks.com>...
> > I am in the middle of an asignement with matlab, whereas i am to arrange two matrixes with 365 days in each, yes you guessed it a yearly statistics of sorts.
> >
> > I have two sources one is 365 days with air temperature, the other is snow fall, and there lies my problem, that matrix is only 212 columns, and im trying to extend that onto 365 columns without destroying the fact that i have measurements on both ends that need to stay where they are in a way... the last measurement needs to come on spot 365 so to speak, so i need to add zeroes in the middle i reckon since no snow in july, not even in norway...
> >
> > can anyone explain how to add such things to this matrix of mine?
>
> % Something like:
>
> test = [1 2 3 4 5;6 7 8 9 10];
> split = 3;
> addCols = 4;
> new_test = [test(:,1:split) zeros(2,addCols) test(:,split+1:end)]
>
> new_test =
>
> 1 2 3 0 0 0 0 4 5
> 6 7 8 0 0 0 0 9 10

so basically this means i can say split on column 120 with split=120;
and then add whatever many columns i need with addCols = x; ?

Subject: Newbie question from a struggling student...

From: Sean de

Date: 17 Nov, 2010 22:10:05

Message: 5 of 20

"Endre Sollid" <stensaker@hotmail.com> wrote in message <ic1jcs$btu$1@fred.mathworks.com>...
> "someone" <someone@somewhere.net> wrote in message <ic1j3f$kek$1@fred.mathworks.com>...
> > "Endre Sollid" <stensaker@hotmail.com> wrote in message <ic1hb8$lm8$1@fred.mathworks.com>...
> > > I am in the middle of an asignement with matlab, whereas i am to arrange two matrixes with 365 days in each, yes you guessed it a yearly statistics of sorts.
> > >
> > > I have two sources one is 365 days with air temperature, the other is snow fall, and there lies my problem, that matrix is only 212 columns, and im trying to extend that onto 365 columns without destroying the fact that i have measurements on both ends that need to stay where they are in a way... the last measurement needs to come on spot 365 so to speak, so i need to add zeroes in the middle i reckon since no snow in july, not even in norway...
> > >
> > > can anyone explain how to add such things to this matrix of mine?
> >
> > % Something like:
> >
> > test = [1 2 3 4 5;6 7 8 9 10];
> > split = 3;
> > addCols = 4;
> > new_test = [test(:,1:split) zeros(2,addCols) test(:,split+1:end)]
> >
> > new_test =
> >
> > 1 2 3 0 0 0 0 4 5
> > 6 7 8 0 0 0 0 9 10
>
> so basically this means i can say split on column 120 with split=120;
> and then add whatever many columns i need with addCols = x; ?

I'll advertise my method again here:
test = [1 2 3 4 5;6 7 8 9 10];
idx = [1 2 4 11 17];
test_results(:,idx) = test;
%{
test_results =

  Columns 1 through 16

     1 2 0 3 0 0 0 0 0 0 4 0 0 0 0 0
     6 7 0 8 0 0 0 0 0 0 9 0 0 0 0 0

  Column 17

     5
    10
%}

It allows you more versatility since you may have more than 1 split.

Subject: Newbie question from a struggling student...

From: Endre Sollid

Date: 17 Nov, 2010 22:18:03

Message: 6 of 20

"Sean de " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <ic1jrt$ch1$1@fred.mathworks.com>...
> "Endre Sollid" <stensaker@hotmail.com> wrote in message <ic1jcs$btu$1@fred.mathworks.com>...
> > "someone" <someone@somewhere.net> wrote in message <ic1j3f$kek$1@fred.mathworks.com>...
> > > "Endre Sollid" <stensaker@hotmail.com> wrote in message <ic1hb8$lm8$1@fred.mathworks.com>...
> > > > I am in the middle of an asignement with matlab, whereas i am to arrange two matrixes with 365 days in each, yes you guessed it a yearly statistics of sorts.
> > > >
> > > > I have two sources one is 365 days with air temperature, the other is snow fall, and there lies my problem, that matrix is only 212 columns, and im trying to extend that onto 365 columns without destroying the fact that i have measurements on both ends that need to stay where they are in a way... the last measurement needs to come on spot 365 so to speak, so i need to add zeroes in the middle i reckon since no snow in july, not even in norway...
> > > >
> > > > can anyone explain how to add such things to this matrix of mine?
> > >
> > > % Something like:
> > >
> > > test = [1 2 3 4 5;6 7 8 9 10];
> > > split = 3;
> > > addCols = 4;
> > > new_test = [test(:,1:split) zeros(2,addCols) test(:,split+1:end)]
> > >
> > > new_test =
> > >
> > > 1 2 3 0 0 0 0 4 5
> > > 6 7 8 0 0 0 0 9 10
> >
> > so basically this means i can say split on column 120 with split=120;
> > and then add whatever many columns i need with addCols = x; ?
>
> I'll advertise my method again here:
> test = [1 2 3 4 5;6 7 8 9 10];
> idx = [1 2 4 11 17];
> test_results(:,idx) = test;
> %{
> test_results =
>
> Columns 1 through 16
>
> 1 2 0 3 0 0 0 0 0 0 4 0 0 0 0 0
> 6 7 0 8 0 0 0 0 0 0 9 0 0 0 0 0
>
> Column 17
>
> 5
> 10
> %}
>
> It allows you more versatility since you may have more than 1 split.

will give it a go and see what happens heh, stupid handin on friday and time growing short on me... :)

Subject: Newbie question from a struggling student...

From: Endre Sollid

Date: 17 Nov, 2010 23:50:06

Message: 7 of 20

I just realised i been asking about the wrong help heh, i have one row stretching 212 columns downward, (my english isnt all to good to explain...) starts on january first goes on downward to april 30th, then skips may, june, july and august, to reasume on sept first. After trying the methods here i still cant make the thing do as supposed.

Let me try to rephrase my question a bit: i need a way to add the 153 missing dates starting may 1st and ending 31 august, altough labeling the dates i can manage on the final plot.

and to not confuse me to much more the file name is sno_2005 and it has the properties 212x1 double. So if you could help me using this filename it would be great, as i am totally green on this programme, took me a while just to import the files heh...

Hope for fast help :)

Subject: Newbie question from a struggling student...

From: proecsm

Date: 18 Nov, 2010 00:30:21

Message: 8 of 20

"Endre Sollid" <stensaker@hotmail.com> wrote in message <ic1pne$t83$1@fred.mathworks.com>...
> I just realised i been asking about the wrong help heh, i have one row stretching 212 columns downward, (my english isnt all to good to explain...) starts on january first goes on downward to april 30th, then skips may, june, july and august, to reasume on sept first. After trying the methods here i still cant make the thing do as supposed.
>
> Let me try to rephrase my question a bit: i need a way to add the 153 missing dates starting may 1st and ending 31 august, altough labeling the dates i can manage on the final plot.
>
> and to not confuse me to much more the file name is sno_2005 and it has the properties 212x1 double. So if you could help me using this filename it would be great, as i am totally green on this programme, took me a while just to import the files heh...
>
> Hope for fast help :)

If I understand correctly, you do not have to expand the snowfall data if you have a time stamp. Take a look at documentation for :

datenum
datetick

a representative sample of the data would be helpful...

Subject: Newbie question from a struggling student...

From: Endre Sollid

Date: 18 Nov, 2010 01:05:06

Message: 9 of 20

"proecsm " <proecsm@gmail.com> wrote in message <ic1s2t$rhm$1@fred.mathworks.com>...
> "Endre Sollid" <stensaker@hotmail.com> wrote in message <ic1pne$t83$1@fred.mathworks.com>...
> > I just realised i been asking about the wrong help heh, i have one row stretching 212 columns downward, (my english isnt all to good to explain...) starts on january first goes on downward to april 30th, then skips may, june, july and august, to reasume on sept first. After trying the methods here i still cant make the thing do as supposed.
> >
> > Let me try to rephrase my question a bit: i need a way to add the 153 missing dates starting may 1st and ending 31 august, altough labeling the dates i can manage on the final plot.
> >
> > and to not confuse me to much more the file name is sno_2005 and it has the properties 212x1 double. So if you could help me using this filename it would be great, as i am totally green on this programme, took me a while just to import the files heh...
> >
> > Hope for fast help :)
>
> If I understand correctly, you do not have to expand the snowfall data if you have a time stamp. Take a look at documentation for :
>
> datenum
> datetick
>
> a representative sample of the data would be helpful...

A sample of the data is like this:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
7,50000000000000
7,50000000000000
7,50000000000000
7,50000000000000
7,50000000000000
7,50000000000000
7,20000000000000
7
9
9,50000000000000
10
10
10
8
8
7,50000000000000

This is the amount of snow on a certain date, as far as i can see there is no such thing as a date or any form of timestamp, its basically a excel sheat starting at 1 and going on to 212, whereas i will need 365 to make a good comparison with the other data set i have. as mentioned in my previous post it goes on like this up to column 120 (if thats the right term) cell 120 is equal to the 30th of april, cell 121 on the other hand is equal to sept 1st, so basically i need to add 153 empty cells in between nr 120 and 121 if i understand this correctly. Or cells containing zeros that is.

hope this clears the matter some?

Subject: Newbie question from a struggling student...

From: someone

Date: 18 Nov, 2010 01:41:04

Message: 10 of 20

"Endre Sollid" <stensaker@hotmail.com> wrote in message <ic1u42$efb$1@fred.mathworks.com>...
> "proecsm " <proecsm@gmail.com> wrote in message <ic1s2t$rhm$1@fred.mathworks.com>...
> > "Endre Sollid" <stensaker@hotmail.com> wrote in message <ic1pne$t83$1@fred.mathworks.com>...
> > > I just realised i been asking about the wrong help heh, i have one row stretching 212 columns downward, (my english isnt all to good to explain...) starts on january first goes on downward to april 30th, then skips may, june, july and august, to reasume on sept first. After trying the methods here i still cant make the thing do as supposed.
> > >
> > > Let me try to rephrase my question a bit: i need a way to add the 153 missing dates starting may 1st and ending 31 august, altough labeling the dates i can manage on the final plot.
> > >
> > > and to not confuse me to much more the file name is sno_2005 and it has the properties 212x1 double. So if you could help me using this filename it would be great, as i am totally green on this programme, took me a while just to import the files heh...
> > >
> > > Hope for fast help :)
> >
> > If I understand correctly, you do not have to expand the snowfall data if you have a time stamp. Take a look at documentation for :
> >
> > datenum
> > datetick
> >
> > a representative sample of the data would be helpful...
>
> A sample of the data is like this:
>
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 7,50000000000000
> 7,50000000000000
> 7,50000000000000
> 7,50000000000000
> 7,50000000000000
> 7,50000000000000
> 7,20000000000000
> 7
> 9
> 9,50000000000000
> 10
> 10
> 10
> 8
> 8
> 7,50000000000000
>
> This is the amount of snow on a certain date, as far as i can see there is no such thing as a date or any form of timestamp, its basically a excel sheat starting at 1 and going on to 212, whereas i will need 365 to make a good comparison with the other data set i have. as mentioned in my previous post it goes on like this up to column 120 (if thats the right term) cell 120 is equal to the 30th of april, cell 121 on the other hand is equal to sept 1st, so basically i need to add 153 empty cells in between nr 120 and 121 if i understand this correctly. Or cells containing zeros that is.
>
> hope this clears the matter some?

% Well, the code I gave you above will still (almost) work.
% You simply have o interchange the row & column operations.
% (And its somewhat simplier since you are talking
% about a vector and not a matrix.)

% Something like:

sn0_2005 = (1:212)'; % note the apostrophe
april30 = 120;
addRows = 153;
all_sn0_2005= [sn0_2005(1:april30) ; zeros(addRows,1) ; sn0_2005(april30+1:end)];

length(all_sn0_2005)

ans =

   365

Subject: Newbie question from a struggling student...

From: Endre Sollid

Date: 18 Nov, 2010 01:49:04

Message: 11 of 20

"someone" <someone@somewhere.net> wrote in message <ic207g$rde$1@fred.mathworks.com>...
> "Endre Sollid" <stensaker@hotmail.com> wrote in message <ic1u42$efb$1@fred.mathworks.com>...
> > "proecsm " <proecsm@gmail.com> wrote in message <ic1s2t$rhm$1@fred.mathworks.com>...
> > > "Endre Sollid" <stensaker@hotmail.com> wrote in message <ic1pne$t83$1@fred.mathworks.com>...
> > > > I just realised i been asking about the wrong help heh, i have one row stretching 212 columns downward, (my english isnt all to good to explain...) starts on january first goes on downward to april 30th, then skips may, june, july and august, to reasume on sept first. After trying the methods here i still cant make the thing do as supposed.
> > > >
> > > > Let me try to rephrase my question a bit: i need a way to add the 153 missing dates starting may 1st and ending 31 august, altough labeling the dates i can manage on the final plot.
> > > >
> > > > and to not confuse me to much more the file name is sno_2005 and it has the properties 212x1 double. So if you could help me using this filename it would be great, as i am totally green on this programme, took me a while just to import the files heh...
> > > >
> > > > Hope for fast help :)
> > >
> > > If I understand correctly, you do not have to expand the snowfall data if you have a time stamp. Take a look at documentation for :
> > >
> > > datenum
> > > datetick
> > >
> > > a representative sample of the data would be helpful...
> >
> > A sample of the data is like this:
> >
> > 0
> > 0
> > 0
> > 0
> > 0
> > 0
> > 0
> > 0
> > 0
> > 0
> > 0
> > 0
> > 0
> > 0
> > 0
> > 0
> > 0
> > 0
> > 0
> > 7,50000000000000
> > 7,50000000000000
> > 7,50000000000000
> > 7,50000000000000
> > 7,50000000000000
> > 7,50000000000000
> > 7,20000000000000
> > 7
> > 9
> > 9,50000000000000
> > 10
> > 10
> > 10
> > 8
> > 8
> > 7,50000000000000
> >
> > This is the amount of snow on a certain date, as far as i can see there is no such thing as a date or any form of timestamp, its basically a excel sheat starting at 1 and going on to 212, whereas i will need 365 to make a good comparison with the other data set i have. as mentioned in my previous post it goes on like this up to column 120 (if thats the right term) cell 120 is equal to the 30th of april, cell 121 on the other hand is equal to sept 1st, so basically i need to add 153 empty cells in between nr 120 and 121 if i understand this correctly. Or cells containing zeros that is.
> >
> > hope this clears the matter some?
>
> % Well, the code I gave you above will still (almost) work.
> % You simply have o interchange the row & column operations.
> % (And its somewhat simplier since you are talking
> % about a vector and not a matrix.)
>
> % Something like:
>
> sn0_2005 = (1:212)'; % note the apostrophe
> april30 = 120;
> addRows = 153;
> all_sn0_2005= [sn0_2005(1:april30) ; zeros(addRows,1) ; sn0_2005(april30+1:end)];
>
> length(all_sn0_2005)
>
> ans =
>
> 365


Thanks a lot :)
And as mentioned im green to this thingy :P so vector or matrix is for me the same heh, but now im off to bed its 3am and that wont help on this matter at all :)

I will probably be back tomorrow with more newbie questions :P

Subject: Newbie question from a struggling student...

From: Steven_Lord

Date: 18 Nov, 2010 15:04:04

Message: 12 of 20



"Endre Sollid" <stensaker@hotmail.com> wrote in message
news:ic1u42$efb$1@fred.mathworks.com...
> "proecsm " <proecsm@gmail.com> wrote in message
> <ic1s2t$rhm$1@fred.mathworks.com>...
>> "Endre Sollid" <stensaker@hotmail.com> wrote in message
>> <ic1pne$t83$1@fred.mathworks.com>...
>> > I just realised i been asking about the wrong help heh, i have one row
>> > stretching 212 columns downward, (my english isnt all to good to
>> > explain...) starts on january first goes on downward to april 30th,
>> > then skips may, june, july and august, to reasume on sept first. After
>> > trying the methods here i still cant make the thing do as supposed.
>> >
>> > Let me try to rephrase my question a bit: i need a way to add the 153
>> > missing dates starting may 1st and ending 31 august, altough labeling
>> > the dates i can manage on the final plot.
>> >
>> > and to not confuse me to much more the file name is sno_2005 and it has
>> > the properties 212x1 double. So if you could help me using this
>> > filename it would be great, as i am totally green on this programme,
>> > took me a while just to import the files heh...
>> >
>> > Hope for fast help :)
>>
>> If I understand correctly, you do not have to expand the snowfall data if
>> you have a time stamp. Take a look at documentation for :
>>
>> datenum
>> datetick
>>
>> a representative sample of the data would be helpful...
>
> A sample of the data is like this:

*snip*

> This is the amount of snow on a certain date, as far as i can see there is
> no such thing as a date or any form of timestamp,

Then as specified there is NO way to determine what date should be
associated with each data point.

Suppose I give you the following data in a vector:

3.9, 5.3, 7.2, 9.6, 12.9, 17.1, 23.1, 31.4, 38.6, 50.2, 62.9, 76.0, 92.0,
105.7, 122.8, 131.7, 150.7, 179.0, 205.0, 226.5, 248.7

What does this mean? What does it represent, and with what day or date
should each point be associated? [*]

> its basically a excel sheat starting at 1 and going on to 212, whereas i
> will need 365 to make a good comparison with the other data set i have. as
> mentioned in my previous post it goes on like this up to column 120 (if
> thats the right term) cell 120 is equal to the 30th of april, cell 121 on
> the other hand is equal to sept 1st

How do you know this? It would seem that wherever you learned this
information _is_ your "date or any form of timestamp".

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

[*] If you've run any of the curve fitting demos in MATLAB you've likely
seen this data in some format -- it's the population data (the pop variable)
from the census.mat data file used by some of the demos. The date
associated with each file is stored as the cdate variable in census.mat.

Subject: Newbie question from a struggling student...

From: Endre Sollid

Date: 18 Nov, 2010 16:55:25

Message: 13 of 20

"Endre Sollid" <stensaker@hotmail.com> wrote in message <ic20mg$ri2$1@fred.mathworks.com>...
> "someone" <someone@somewhere.net> wrote in message <ic207g$rde$1@fred.mathworks.com>...
> > "Endre Sollid" <stensaker@hotmail.com> wrote in message <ic1u42$efb$1@fred.mathworks.com>...
> > > "proecsm " <proecsm@gmail.com> wrote in message <ic1s2t$rhm$1@fred.mathworks.com>...
> > > > "Endre Sollid" <stensaker@hotmail.com> wrote in message <ic1pne$t83$1@fred.mathworks.com>...
> > > > > I just realised i been asking about the wrong help heh, i have one row stretching 212 columns downward, (my english isnt all to good to explain...) starts on january first goes on downward to april 30th, then skips may, june, july and august, to reasume on sept first. After trying the methods here i still cant make the thing do as supposed.
> > > > >
> > > > > Let me try to rephrase my question a bit: i need a way to add the 153 missing dates starting may 1st and ending 31 august, altough labeling the dates i can manage on the final plot.
> > > > >
> > > > > and to not confuse me to much more the file name is sno_2005 and it has the properties 212x1 double. So if you could help me using this filename it would be great, as i am totally green on this programme, took me a while just to import the files heh...
> > > > >
> > > > > Hope for fast help :)
> > > >
> > > > If I understand correctly, you do not have to expand the snowfall data if you have a time stamp. Take a look at documentation for :
> > > >
> > > > datenum
> > > > datetick
> > > >
> > > > a representative sample of the data would be helpful...
> > >
> > > A sample of the data is like this:
> > >
> > > 0
> > > 0
> > > 0
> > > 0
> > > 0
> > > 0
> > > 0
> > > 0
> > > 0
> > > 0
> > > 0
> > > 0
> > > 0
> > > 0
> > > 0
> > > 0
> > > 0
> > > 0
> > > 0
> > > 7,50000000000000
> > > 7,50000000000000
> > > 7,50000000000000
> > > 7,50000000000000
> > > 7,50000000000000
> > > 7,50000000000000
> > > 7,20000000000000
> > > 7
> > > 9
> > > 9,50000000000000
> > > 10
> > > 10
> > > 10
> > > 8
> > > 8
> > > 7,50000000000000
> > >
> > > This is the amount of snow on a certain date, as far as i can see there is no such thing as a date or any form of timestamp, its basically a excel sheat starting at 1 and going on to 212, whereas i will need 365 to make a good comparison with the other data set i have. as mentioned in my previous post it goes on like this up to column 120 (if thats the right term) cell 120 is equal to the 30th of april, cell 121 on the other hand is equal to sept 1st, so basically i need to add 153 empty cells in between nr 120 and 121 if i understand this correctly. Or cells containing zeros that is.
> > >
> > > hope this clears the matter some?
> >
> > % Well, the code I gave you above will still (almost) work.
> > % You simply have o interchange the row & column operations.
> > % (And its somewhat simplier since you are talking
> > % about a vector and not a matrix.)
> >
> > % Something like:
> >
> > sn0_2005 = (1:212)'; % note the apostrophe
> > april30 = 120;
> > addRows = 153;
> > all_sn0_2005= [sn0_2005(1:april30) ; zeros(addRows,1) ; sn0_2005(april30+1:end)];
> >
> > length(all_sn0_2005)
> >
> > ans =
> >
> > 365
>
>
> Thanks a lot :)
> And as mentioned im green to this thingy :P so vector or matrix is for me the same heh, but now im off to bed its 3am and that wont help on this matter at all :)
>
> I will probably be back tomorrow with more newbie questions :P

this was a lot of help, but basically all the data before and after the split were replaced bu numbering of the cells, although the length of the datasheat turned out right, i cant plot it into my figure since it only returns weird values. deleting the values there originally, and as i said replaced them with numbering of cells why is this?

Subject: Newbie question from a struggling student...

From: Endre Sollid

Date: 18 Nov, 2010 18:02:04

Message: 14 of 20


>
> this was a lot of help, but basically all the data before and after the split were replaced bu numbering of the cells, although the length of the datasheat turned out right, i cant plot it into my figure since it only returns weird values. deleting the values there originally, and as i said replaced them with numbering of cells why is this?



so this is what i tried now:
 utvida_sno= [sno(1:120,:); zeros(153,3); sno(122,:)] that worked somehow as it kept the values from cell 1 to cell 120, although i ended up with a total of only 274 cells..? whereas i wanted it to end up as 365.

so to explain again shortly, im trying to put 153 empty cells inbetween cell 120 and cell 121...

aparently this is a vector not a matrix by the way :P so what i want is 1 downward going row/column? with 365 cells, whereas all data in cells 1-120 is kept where they are, and cell 121-212 needs to be moved to 274-365 still containing the data it does.

can anyone give me a hint of how to modify this please?

Subject: Newbie question from a struggling student...

From: Steven_Lord

Date: 18 Nov, 2010 18:26:16

Message: 15 of 20



"Endre Sollid" <stensaker@hotmail.com> wrote in message
news:ic3pms$afk$1@fred.mathworks.com...
>
>>
>> this was a lot of help, but basically all the data before and after the
>> split were replaced bu numbering of the cells, although the length of the
>> datasheat turned out right, i cant plot it into my figure since it only
>> returns weird values. deleting the values there originally, and as i said
>> replaced them with numbering of cells why is this?
>
>
>
> so this is what i tried now:
> utvida_sno= [sno(1:120,:); zeros(153,3); sno(122,:)] that worked somehow
> as it kept the values from cell 1 to cell 120, although i ended up with a
> total of only 274 cells..? whereas i wanted it to end up as 365.

sno(1:120, :) has 120 rows
zeros(153, 3) has 153 rows
sno(122, :) has 1 row

120+153+1 = 274.

Did you mean for your last expression to be sno(122:end, :) or sno(122:212,
:) instead? If sno had 365-153 = 212 rows, this would give you a final
utvida_sno with 365 rows.

> so to explain again shortly, im trying to put 153 empty cells inbetween
> cell 120 and cell 121...
>
> aparently this is a vector not a matrix by the way :P so what i want is 1
> downward going row/column? with 365 cells, whereas all data in cells 1-120
> is kept where they are, and cell 121-212 needs to be moved to 274-365
> still containing the data it does.
>
> can anyone give me a hint of how to modify this please?

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Newbie question from a struggling student...

From: Endre Sollid

Date: 18 Nov, 2010 18:47:03

Message: 16 of 20

 

> Did you mean for your last expression to be sno(122:end, :) or sno(122:212,
> :) instead? If sno had 365-153 = 212 rows, this would give you a final
> utvida_sno with 365 rows.


Thats exactly what i meant :), and i figured it out after dragging my hair for quite a bit, i thought that is i just wrote 122,: it would add all following as well, but that it didnt :P

Thanks again for all the help :)

Subject: Newbie question from a struggling student...

From: Endre Sollid

Date: 18 Nov, 2010 19:56:03

Message: 17 of 20

This just isnt my day i reckon...

Now that i have the data plotted and all, i would like to be able to "smoothen" out the lines and make an average out of theese datasets, and then plot them as well.

The dataset is the same as before with 365x1

I tried this formulae: average= [sno2005(365,1), sno2005(1,:), sno2005(365,1)]
wich gave me the following return: 0 0 6 to me it apears it just took a few lines in the entire dataset and not all of it.

also do i need to add a zeroes list as well that is of similar length and such as the main dataset for an average to work?

Tried looking on online help and such but i cant find anything (probably no good at searching either)

So hopefully anyone can help me with this as well, and as this is last part of the asignement i hopefully will not hold you people up anymore.





 

Subject: Newbie question from a struggling student...

From: dpb

Date: 18 Nov, 2010 20:17:07

Message: 18 of 20

Endre Sollid wrote:
> This just isnt my day i reckon...
>
> Now that i have the data plotted and all, i would like to be able to
> "smoothen" out the lines and make an average out of theese datasets, and
> then plot them as well.
>
> The dataset is the same as before with 365x1
>
> I tried this formulae: average= [sno2005(365,1), sno2005(1,:),
> sno2005(365,1)]
> wich gave me the following return: 0 0 6 to me it apears it
> just took a few lines in the entire dataset and not all of it.
...

average= [sno2005(365,1), sno2005(1,:), sno2005(365,1)]

All that does is create a vector of three points but the code line and
the supposed data don't jibe--the first and last points are the same in
the above so the output must be symmetric, whatever the values in the array.

Also, if the dimensions are 365x1, then x(1,:) is the same thing as x(1,1)

Not sure what you think you want to do here, but what you did isn't of
much value and it surely isn't doing any averaging or smoothing.

doc mean % for computing average of vector/array

doc filter % for filtering function as one approach to smoothing

doc median % for another

--

Subject: Newbie question from a struggling student...

From: Endre Sollid

Date: 18 Nov, 2010 21:16:03

Message: 19 of 20

dpb <none@non.net> wrote in message <ic41sp$qh7$1@news.eternal-september.org>...
> Endre Sollid wrote:
> > This just isnt my day i reckon...
> >
> > Now that i have the data plotted and all, i would like to be able to
> > "smoothen" out the lines and make an average out of theese datasets, and
> > then plot them as well.
> >
> > The dataset is the same as before with 365x1
> >
> > I tried this formulae: average= [sno2005(365,1), sno2005(1,:),
> > sno2005(365,1)]
> > wich gave me the following return: 0 0 6 to me it apears it
> > just took a few lines in the entire dataset and not all of it.
> ...
>
> average= [sno2005(365,1), sno2005(1,:), sno2005(365,1)]
>
> All that does is create a vector of three points but the code line and
> the supposed data don't jibe--the first and last points are the same in
> the above so the output must be symmetric, whatever the values in the array.
>
> Also, if the dimensions are 365x1, then x(1,:) is the same thing as x(1,1)
>
> Not sure what you think you want to do here, but what you did isn't of
> much value and it surely isn't doing any averaging or smoothing.
>
> doc mean % for computing average of vector/array
>
> doc filter % for filtering function as one approach to smoothing
>
> doc median % for another
>
> --

its the mean function i am after, but i cant figure out the formulae i need to make it do a mean of every 6 cells or every 10 for that matter.

Does that make it clearer?

Subject: Newbie question from a struggling student...

From: someone

Date: 18 Nov, 2010 22:49:04

Message: 20 of 20

"Endre Sollid" <stensaker@hotmail.com> wrote in message <ic452j$fur$1@fred.mathworks.com>...
> dpb <none@non.net> wrote in message <ic41sp$qh7$1@news.eternal-september.org>...
> > Endre Sollid wrote:
> > > This just isnt my day i reckon...
> > >
> > > Now that i have the data plotted and all, i would like to be able to
> > > "smoothen" out the lines and make an average out of theese datasets, and
> > > then plot them as well.
> > >
> > > The dataset is the same as before with 365x1
> > >
> > > I tried this formulae: average= [sno2005(365,1), sno2005(1,:),
> > > sno2005(365,1)]
> > > wich gave me the following return: 0 0 6 to me it apears it
> > > just took a few lines in the entire dataset and not all of it.
> > ...
> >
> > average= [sno2005(365,1), sno2005(1,:), sno2005(365,1)]
> >
> > All that does is create a vector of three points but the code line and
> > the supposed data don't jibe--the first and last points are the same in
> > the above so the output must be symmetric, whatever the values in the array.
> >
> > Also, if the dimensions are 365x1, then x(1,:) is the same thing as x(1,1)
> >
> > Not sure what you think you want to do here, but what you did isn't of
> > much value and it surely isn't doing any averaging or smoothing.
> >
> > doc mean % for computing average of vector/array
> >
> > doc filter % for filtering function as one approach to smoothing
> >
> > doc median % for another
> >
> > --
>
> its the mean function i am after, but i cant figure out the formulae i need to make it do a mean of every 6 cells or every 10 for that matter.
>
> Does that make it clearer?

If you have a vector, v, of n values, then
what would v(1:6:n) or v(1:10:n) give you?

You have asked some VERY basic questions in this thread.
You should read the MATLAB "Getting Started Guide" at:

http://www.mathworks.com/help/techdoc/learn_matlab/bqr_2pl.html

It is a quick read and it would answer just about every question you have asked.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us