Can Matlab cellular functions -like cellfun- work with non linearly spaced indices ?
Hi,
I would like to affect a value to some non linearly indexed elements of a vector with using a cell array.
At the moment I index a for loop with a non linearly spaced row index. Let’s say :
N = 8;
id = find(randi(2,1,N)-1); % non zeros positions in a random vector of binaries
u = true(1,N);
for k = id
u(1,k:k:end) = false;
end
How would I do the same affectations with cellfun for instance ?
Thank you for help.
Cheers.
NicolasHi,
I would like to affect a value to some non linearly indexed elements of a vector with using a cell array.
At the moment I index a for loop with a non linearly spaced row index. Let’s say :
N = 8;
id = find(randi(2,1,N)-1); % non zeros positions in a random vector of binaries
u = true(1,N);
for k = id
u(1,k:k:end) = false;
end
How would I do the same affectations with cellfun for instance ?
Thank you for help.
Cheers.
Nicolas Hi,
I would like to affect a value to some non linearly indexed elements of a vector with using a cell array.
At the moment I index a for loop with a non linearly spaced row index. Let’s say :
N = 8;
id = find(randi(2,1,N)-1); % non zeros positions in a random vector of binaries
u = true(1,N);
for k = id
u(1,k:k:end) = false;
end
How would I do the same affectations with cellfun for instance ?
Thank you for help.
Cheers.
Nicolas indexing, index, cellular, element wise, non linear MATLAB Answers — New Questions