Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Subject: Matlab %% How do I take the answer generated from a for loop and put it into an if statement? TNY =[31, 26, 30,

Subject: Matlab

%% How do I take the answer generated from a "for loop" and put it into an "if" statement?

TNY =[31, 26, 30, 33, 33, 39, 41, 41, 34, 33, 45, 42, 36, 39, 37, 45,43, 36, 41, 37, 32, 32, 35, 42, 38, 33, 40, 37, 36, 51, 50];

TAN =[37, 24, 28, 25, 21, 28, 46, 37, 36, 20, 24, 31, 34, 40, 43, 36, 34, 41, 42, 35, 38, 36, 35, 33, 42, 42, 37, 26, 20, 25, 31];

R = zeros(size(TNY));

for i = 1:length(TAN) R = R + (TNY==TAN(1,i)); end

R

================================================================================

R= [ 2 1 0 1 1 0 1 1 2 1 0 3..............]

I want to add 1 to any number that is not zero. How do I do that?

I've tried using

if R>0

Z=R+1

end

That doesn't work. Please help! Thanks!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions

Question

plan the stages of an ad campaign;

Answered: 1 week ago