Thank you so much, Samuel.
Your example worked very well, and I have incorporated it in my work using
the following function:
function m = removenan(m, direction)//remove any row or column with missing
values
if (direction(1)=="r") then
m(:,or(isnan(m),'r')) = [];//delete all columns with %nan
else
m(or(isnan(m),'c'),:) = [] //delete all rows with %nan
end
endfunction
Samuel Ogbonna Enibe
University of Nigeria, Nsukka, Nigeria
On Tue, Oct 2, 2012 at 7:44 PM, Samuel Gougeon <[email protected]> wrote:
> **
> Hello,
>
> Le 02/10/2012 19:33, [email protected] a écrit :
>
> Dear sir,
>
> Is there an existing function in SCILAB to remove all rows or columns with
> with one or more missing values from a matrix such as X.
>
> I want to avoid the alternative of using the scipts such as
> K = find(isnan(X))
> And then converting the K to row,column format before deleting the rows or
> columns with missing values.
>
>
> I am afraid that a set of instructions is required. One possibility is
> the following
> (to delete *columns* with one or more %nan) :
>
> m = rand(5,5);
> m(3,2) = %nan;
> m(2,4) = %nan
>
> m(:,or(isnan(m),*'r'*)) = []
> // m(or(isnan(m),*'c'*),:) = [] // for rows
>
>
> Regards
> Samuel
>
>
>
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.scilab.org/mailman/listinfo/users
>
>
--
_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users