In Matlab if you need to replace certain values with a single value you can simple do this,
>u(find(isnan(u))) = [];
Using this will find and remove all the NaN (Not a Number) values.
If you want to remove any value you can simple use find again,
>u(find(u=9999)) = [];
This will remove all the values of u = 9999.
Be aware that applying this will make your vector shorter if there is any value removed.
1 comment:
You can actually skip the find command. This is logical indexing, which usually works faster.
Post a Comment