Vector access and manipulation
2 views (last 30 days)
Let's say I'm doing a certain task and have to call a function.
Let's also say that there is a vector Vec = [a b c] that can contain Vec=[0 0 0] or internal numbers for example Vec=[ 3 8 10].
Let's say the output of function is Out (Vec (1)).
Of course when the Vec Vector is null Out (0) does not exist.
Is there a way to tell matlab not to consider this output Out (0)?
Nora Khaled on 22 Nov 2020
do you only discard the function output for a vector of all zeros? or for zero elements.
why not use if-else
f =@(x) x.^2;
Vec=[3 8 10];
disp('vector of zeros')