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.
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:
Get Answers For Free
Most questions answered within 1 hours.