MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Vandana
on 19 Sep 2013

count=0; j=1; for i=1:ro if(rV(i)>0) rda(j)=i; rca(j)=1; count=0; j=j+1; elseif(count==0) rda(j)=i; rca(j)=0; j=j+1; count=1; else count=1; end; end;

flag=1; k=1; for i=1:j-2 if((rda(i+1)-rda(i))>=12) if(flag==1) ra(k)=rda(i); k=k+1; flag=0; end; else flag=1; ra(k)=rda(i); end end

where ro means number of rows and rv means row variance and rda and rca are normal variable.

[EDITED, Jan, code indented for demonstration]

*No products are associated with this question.*

Answer by Image Analyst
on 19 Sep 2013

It looks like the code functions to produce arrays called ra, rca, and rda. It looks like perhaps some kind of counting or thresholding operation but with no comments it's hard to figure out their intent. Why don't you ask the author, and ask them why they write code with no comments in it? Or ask *them* what their intent is?

Show 1 older comment

Walter Roberson
on 20 Sep 2013

It appears to be Hindi, and it appears that Google Translate does a terrible job with romanized Hindi. My investigation is suggestive that "kuch" translates as "something" or perhaps "anything". I don't know... "please edit the code" ??

## 4 Comments

## Jan Simon (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/87653#comment_169837

Please format your code properly.

Please explain your question with any details. Of course the function of this code is to produce the results. It is hard to describe the procedure more compact than as Matlab code. So please explain, which command or part is not clear to you. It would be too inefficient to guess, which explanations you need.

## Image Analyst (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/87653#comment_169848

Tip: Before pasting your code in here, when it's still in MATLAB, type ctrl-a (to select all the code), and then Ctrl-i (to fix the indenting).

## Vandana (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/87653#comment_169849

this is the formatted code sir I don't know sir why preview is looking like this.sir I want explaination of each line what it is doing.sir before this code I calculated the rowwise variance and column wise variance.

thank you

## Jan Simon (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/87653#comment_170037

@Vandana: Did you try Ctrl-A Ctrl_I for an auto-indentation in Matlab's editor?