help-octave
[Top][All Lists]

## Re: Function

 From: Juan Pablo Carbajal Subject: Re: Function Date: Sun, 1 Nov 2015 14:38:38 +0100

```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.

```