Question

message time 1200 1205 1225 1240 1245 1255 1325 hello world 1330 today is 1342 how...

message time
1200
1205
1225
1240
1245

1255

1325
hello world 1330
today is 1342
how are you 1354
what are you doing 1400
good bye 1409
1410
1424

Using MATLAB. Determine when 'hello world' message occurs (index and time). Print result to command window.

Homework Answers

Answer #1

MATLAB Code:

% Using MATLAB command determine when 'hello world' message occurs

% Storing messages in a vector
mesgs = {"", "", "", "", "", "", "", "hello world", "today is", "how are you", "what are you doing", "good bye", "", ""};

% Storing time in a vector
time = [1200 1205 1225 1240 1245 1255 1325 1330 1342 1354 1400 1409 1410 1424];

% Finding index of message hello world
idx = find(strcmp(mesgs, "hello world"));

% Printing index and time
fprintf("\n Message hello world occurs at index %d \n", idx);
fprintf("\n Message hello world occurs at time %d \n", time(idx));

________________________________________________________________________________________________

Sample Run:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT