Question

x.3 1.3e+02 2 Ore ersion un SCII Sta Exercise 5.3 1. Make a cell array called c that contains the following eleven strings th
CHAPTER 5: Data Types 138 SLS the Write code that accesses the cell at index 7 i 2. use the correct type of brackets. Use the

need answer for matlab programming for engineers and scientists
x.3 1.3e+02 2 Ore ersion un SCII Sta Exercise 5.3 1. Make a cell array called c that contains the following eleven strings the cow l num- 7.2
CHAPTER 5: Data Types 138 SLS the Write code that accesses the cell at index 7 i 2. use the correct type of brackets. Use the function class to confirm that a cell is returned. I c 3. write code that accesses the cells with odd indices in the array c, e the cells at indices 1, 3, 5, etc. How many cells are returned? 4. Write code that accesses the cells with even indices in the array c. 5. Write code to access the string contained in the cell at index 5 of the . Wirie ccharacter of the sting contained an 6. Write code that accesses the last character of the string contained in the cell at index 5 in array c. a 7. Make a new cell array d that contains at least three different data types. Exercise 5.4 O5.C A variable is set by the co ior is 1. mmand a 10. The default MATLAB behav to set a to double precision. Use the eps command to determib the precision the precision change if the initial command of the variable. How would the precision change if th a 1000000? Confirm your predi mand n, a 2. The i
0 0
Add a comment Improve this question Transcribed image text
Answer #1

scriptarr.m:

mycell = {'the',' ','cow',' ','jumped',' ','over',' ','the',' ','moon'};
fprintf("The string at mycell{7} is: %s\n",mycell{7});
%access and print string contained in cell at index 7

fprintf("The odd indexed elements in cell array are: \n");
%access and print string contained in odd indices
for i = 1:11
    if mod(i,2)!=0
        fprintf("mycell{%d}: %s\n",i,mycell{i});
    end
end

fprintf("The even indexed elements in cell array are: \n");
%access and print string contained in odd indices
for i = 1:11
    if mod(i,2)==0
        fprintf("mycell{%d}: %s\n",i,mycell{i});
    end
end
fprintf("The string at mycell{5} is: %s\n",mycell{5});
%access and print string contained in cell at index 5

fprintf("The string at mycell{5} is: %c\n",mycell{5}(end));
%access and print last character of string contained in cell at index 5

newmycell = {1,2;'helllo','hi';9.0,7.8};
%creating new cell with atleast 3 datatypes
display(newmycell{1,2});
%accessing 2 from given newmycell

Output:

octave:17> source(scriptarr.m) The string at mycell7} is: over The odd indexed elements in cell array are: mycellfl}: the m

Add a comment
Know the answer?
Add Answer to:
need answer for matlab programming for engineers and scientists x.3 1.3e+02 2 Ore ersion un SCII Sta Exercise 5.3 1. Make a cell array called c that contains the following eleven strings the c...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT