MATLAB Answers


Help with a simple loop?

Asked by Xingde
on 2 Apr 2013

% For version1, we can get the expected answer. but for version2, p==0.3 and p==0.7 give us all zeros?

% What's wrong here? Any comments are welcome!

%% compare version1 and version2

p = 0.1:0.1:0.9;
for q = 0.1:0.1:0.9
	r = (p==q)



No products are associated with this question.

1 Answer

Answer by Image Analyst
on 2 Apr 2013
 Accepted answer

  1 Comment

on 2 Apr 2013

Thank you so much! I should know that because in linear algebra we talked about it.

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!