I've written this code :
A
is a nXm
matrix
[nA, mA] = size(A);
currentVector(nA,mA) = 0;
for i = 1: nA
for j = 1 : mA
if A (i,j) ~= 0
currentVector(i,j) = ceil(log10( abs(A(i,j)) ));
else
currentVector(i,j) = 0;
end
end
end
How can I write the above code in a more "matlab" way ?
Are there any shortcuts for if/else and for loops ? for example in C
:
int a = 0;
int b = 10;
a = b > 100 ? b : a;
Those if/else
conditions keeps reminding me of C
and Java
.
Thanks