what it mean s(1) and s(2)
Mostra commenti meno recenti
Hello guys. I found a matlab code and in this code we have 2 variables called s(1) and s(2). my question is what are the 2 variables s(1) and s(2) ? What mean s(1) and s(2) ? here the code:
r=s(1);
c=s(2);
for x=(n+1+10):(s(1)+n-10)
for y=(n+1+10):(s(2)+n-10)
e=1;
for k=x-n:x+n
f=1;
for l=y-n:y+n
mat(e,f)=temp(k,l);
f=f+1;
end
e=e+1;
end;
end;
end;
1 Commento
Here is an equation:
a = b + c
What are a, b, and c? Who knows? Only the original author knows. Same with your piece of code. Go and ask the author.
edit: And how come you're using a piece of code if you don't even know what it does?
edit2: And it's a totally useless piece of code in any case. The two outer loops overwrite the same variable, so actually do nothing until the last iteration. The two inner loops are a very inefficient way of copying part of a matrix. All in all, the whole code is the same as:
mat = temp(s(1)-10:s(1)+2*n-10, s(2)-10:s(2)+2*n-10)
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Matrix Indexing in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!