In my simulation this function is called many time and I would improve in terms of speed this function so I can earn in execution time this is the function
function [ruffled_head] = ruffle_head(head_rcv)while 1 ruffled_head = head_rcv(randi(length(head_rcv)); if ruffled_head ~= 0 break; end endend
this function receives a vector that is made of integer values and also zeros. it should return an integer value different from zero. I think that this function could be better.Any idea how to improve?
Best Answer