For example:
if logical([0, 0, 1)]) % code
end
arrayconditioniflogical?vector
if logical([0, 0, 1)]) % code
end
>> 'false'==1ans = 0 0 0 0 0
Function 'subsindex' is not defined for values of class 'cell'
>> m = cell2mat(a);>> id0 = m==0;>> id1 = m==1;>> a(id0) = {'false'};>> a(id1) = {'true'};>> aa = 'false' 'true' [ 2] [ 3] [ 4] [ 5] [ 6] [ 7] [ 8] [ 9] [ 10] [ 11] 'true' 'false' 'false' 'false' 'false' 'false' 'false' 'false' 'false' 'false' 'false' 'false' [ 2] 'true' 'true' 'true' 'false' 'false' 'true' 'false' 'false' 'false' 'false' 'false' [ 3] 'true' 'true' 'true' 'false' 'false' 'true' 'false' 'false' 'false' 'false' 'false' [ 4] 'true' 'true' 'true' 'false' 'false' 'true' 'false' 'false' 'false' 'false' 'false' [ 5] 'true' 'true' 'true' 'false' 'false' 'true' 'false' 'false' 'false' 'false' 'false' [ 6] 'true' 'true' 'true' 'false' 'false' 'true' 'false' 'false' 'false' 'false' 'false' [ 7] 'true' 'true' 'true' 'false' 'false' 'true' 'false' 'false' 'false' 'false' 'false' [ 8] 'true' 'true' 'true' 'false' 'false' 'true' 'false' 'false' 'false' 'false' 'false' [ 9] 'true' 'true' 'true' 'false' 'false' 'true' 'false' 'false' 'false' 'false' 'false' [ 10] 'true' 'true' 'true' 'false' 'false' 'true' 'false' 'false' 'false' 'false' 'false' [ 11] 'true' 'true' 'true' 'false' 'false' 'true' 'false' 'true' 'false' 'false' 'false'
>> c = {'false','true'};>> b = c(1+m(2:end,2:end))b = 'false' 'false' 'false' 'false' 'false' 'false' 'false' 'false' 'false' 'false' 'false' 'true' 'true' 'true' 'false' 'false' 'true' 'false' 'false' 'false' 'false' 'false' 'true' 'true' 'true' 'false' 'false' 'true' 'false' 'false' 'false' 'false' 'false' 'true' 'true' 'true' 'false' 'false' 'true' 'false' 'false' 'false' 'false' 'false' 'true' 'true' 'true' 'false' 'false' 'true' 'false' 'false' 'false' 'false' 'false' 'true' 'true' 'true' 'false' 'false' 'true' 'false' 'false' 'false' 'false' 'false' 'true' 'true' 'true' 'false' 'false' 'true' 'false' 'false' 'false' 'false' 'false' 'true' 'true' 'true' 'false' 'false' 'true' 'false' 'false' 'false' 'false' 'false' 'true' 'true' 'true' 'false' 'false' 'true' 'false' 'false' 'false' 'false' 'false' 'true' 'true' 'true' 'false' 'false' 'true' 'false' 'false' 'false' 'false' 'false' 'true' 'true' 'true' 'false' 'false' 'true' 'false' 'true' 'false' 'false' 'false'
W = 0:3000 ;k1 = 10^4 ;k2 = 1.5*10^4 ;d = 0.1 ;x = zeros(size(W)) ;for i = 1:length(W) x(i) = calcDist(W(i),k1,k2,d)endplot(x,W)
Best Answer