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

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Sivakumaran Chandrasekaran
on 10 Sep 2012

When i perform a 'if' loop operation, 7 outputs are generated.. the outputs are 2,5,34.. etc., how to find the number of outputs generated.

Answer by Azzi Abdelmalek
on 10 Sep 2012

Edited by Azzi Abdelmalek
on 10 Sep 2012

t=xlsread('table.xlsx'); w=t(:,2:5); v=w(:,2:4); Output_Number=0 for i=1:14 numerator = ismember(v,v(i,:),'rows'); if (sum(numerator)==1) t(:,6)=0; Output_Number=Output_Number+1 end end

## 4 Comments

## TAB (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/47722#comment_98459

'if'is conditional statement, not a loop !## Jan Simon (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/47722#comment_98475

I suggest to post th code. Otherwise we can only guess what you are talking about.

But when I read the question word by word, the answer seem to be easy: The number of generated outputs is 7.

## Sivakumaran Chandrasekaran (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/47722#comment_98482

t=xlsread('table.xlsx');

w=t(:,2:5);

v=w(:,2:4);

for i=1:14

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/47722#comment_98589

Sivakumaran, please add meaningful tags to this question to make it easier to categorize. See http://www.mathworks.co.uk/matlabcentral/answers/43073-a-guide-to-tags