Using logicals in arrayfun
Hi,
I have two arrays:
tempA, size(10, 18)
tempB, size(1, 10) (is a column vector),
For each row in tempA, I want to extract the number of columns specified for that row by tempB. However, there are certain rows in tempB that are ‘nan’.
u = arrayfun(@(x,y) x{1}(1:y), tempA, tempB, ‘UniformOutput’, false);
Can I use logical in the arrayfun so that it automatically excludes cases that are ‘nan’?
Thank youHi,
I have two arrays:
tempA, size(10, 18)
tempB, size(1, 10) (is a column vector),
For each row in tempA, I want to extract the number of columns specified for that row by tempB. However, there are certain rows in tempB that are ‘nan’.
u = arrayfun(@(x,y) x{1}(1:y), tempA, tempB, ‘UniformOutput’, false);
Can I use logical in the arrayfun so that it automatically excludes cases that are ‘nan’?
Thank you Hi,
I have two arrays:
tempA, size(10, 18)
tempB, size(1, 10) (is a column vector),
For each row in tempA, I want to extract the number of columns specified for that row by tempB. However, there are certain rows in tempB that are ‘nan’.
u = arrayfun(@(x,y) x{1}(1:y), tempA, tempB, ‘UniformOutput’, false);
Can I use logical in the arrayfun so that it automatically excludes cases that are ‘nan’?
Thank you array function, logicals MATLAB Answers — New Questions