Clear Filters
Clear Filters

my program throws multiple exceptions but I want to code it like that when it receives first exception should not move furthur and quit by returning a value

2 views (last 30 days)
input to svd is
Inf NaN NaN
NaN NaN NaN
NaN NaN NaN
Error using svd
Input to SVD must not contain NaN or Inf.
CODE IS:::
s = svd(A);
if any(s == 0) % Handle singular matrix
c = Inf(class(A));
else
c = max(s)./min(s);
if isempty(c)
c = zeros(class(A));
end
end

Answers (1)

Walter Roberson
Walter Roberson on 27 Sep 2018
https://www.mathworks.com/matlabcentral/answers/420813-a-test-to-exclude-inf-and-nans-from-pinv-doesn-t-work#answer_338496

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!