help-octave
[Top][All Lists]

## Re: Function

 From: Juan Pablo Carbajal Subject: Re: Function Date: Mon, 2 Nov 2015 21:15:47 +0100

```On Mon, Nov 2, 2015 at 7:38 PM, Michaela Magennis
>
>
>> Date: Sun, 1 Nov 2015 14:38:38 +0100
>> Subject: Re: Function
>
>>
>> On Sun, Nov 1, 2015 at 2:01 PM, Michaela Magennis
>> > In the script I have wrote A=para1(M5) hoping this have returned the
>> > matrix.
>> > In the new function I have been asked to pull that old matrix into my
>> > new
>> > function and use that to write a function that will enable me to get
>> > both
>> > the minimum measurements and mean measurements. So what I need to write
>> > as a
>> > function is rescaled measurement = (measurement-minimum
>> > measurement)/mean
>> > measurement. I don't know how to write this as a function though.
>> >
>> >> Date: Sun, 1 Nov 2015 10:04:20 +0100
>> >> Subject: Re:
>> >>
>> >> On Sat, Oct 31, 2015 at 11:49 PM, Michaela Magennis
>> >> > I was just wonder if you could tell me how I pass a matrix from one
>> >> > function
>> >> > to a new function in order to get mean measurements and minimum
>> >> > measurements
>> >> > in order to get rescaled measurements
>> >> >
>> >> > _______________________________________________
>> >> > Help-octave mailing list
>> >> > https://lists.gnu.org/mailman/listinfo/help-octave
>> >> >
>> >>
>> >> I am not sure I understod, but to pass a matrix as an argument you do
>> >>
>> >> A = function1 (x) #returns a matrix
>> >> B = function2 (A) # input argument is the matrix
>> >>
>> >> check the function mean, maybe that one helps you.
>>
>> Michaela,
>>
>> Please keep the mailing list always in copy. Try to answer at the
>> bottom as I am doing now.
>>
>> Please send your script and function so we can see what the problem is.
>>
>> if you write a function
>>
>> function y = func1 (A)
>> y = min (A(:))
>> endfunction
>>
>> you can use it like this
>>
>> A = randn (10,10);
>> m = func1 (A);
>>
>> and m will contain the minimum value of the whole matrix.
> ___________________________________________________________________________________________________________
>
> Attached is a picture of my current script and my first function. I know
> have to within my script pass the matrix returned by the previous function
> to my new function. This new function should be able to calculate the mean
> measurement for each number. It should also rescale the measurements across
> the five time poitns according to Rescaledmeasurement=(measurement/mininium
> measurement)/meanmeasurement. I also want to make sure all the time courses
> start from the same expression level which i have choose to be 1. In order
> to achieve this i have be told to use the formula.
> (1-RescaledMeasurementAt0Hrs). This should then return the matrix to the
> script, placing the resulting matrix in a new variable within the script.

Please keep the octave mailing list in CC.
place like https://bpaste.net/
I did not read the script in detail, but please do notice that you are
writing a line for every row of input1.
You can just do
input1(:,1) + input1(:,2)
to add the two columns or just
sum (input, 2)

I think that you should try to follow some tutorials online or read
more Octave code examples.
https://en.wikibooks.org/wiki/Octave_Programming_Tutorial

```