help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re-assign special values in matrix


From: Isak Delberth Davids
Subject: re-assign special values in matrix
Date: Fri, 12 Nov 2010 08:04:11 +0200

Here comes a lay-man,

I intend to avoid dividing by zero, by re-assigning a different value to a entry that is zero in a divisor matrix. In the following code I want to search for that entry of A which equals zero (being A(7) in this case), and give it a value that is greater then zero but smaller than all other non-zero entries (which is A(3)=9 in this case). I am trying a if-statement as can be seen --- which seems WRONG. Where should I fix?

% code begin
clear;clc;

a = [3; 2; 1; 3; 4; 5; 1]
A = [12; 11; 9; 13; 67; 44; 0]

min(A(A~=0)) = A(A==0) % trying to set the zero values in divisor matrix to the min non-zero entry?

B = a./A
% code begin

regards,

* * * * * * * * * * * * * * *
*  Isak Delbert Davids *
*  +264-81-33 049 33  *
*  +264-61-206 3789   *
*    Namibia, Afrika     *
* * * * * * * * * * * * * * *


reply via email to

[Prev in Thread] Current Thread [Next in Thread]