
Concept explainers
To write:
An expression that would display a random element from a cell array and a

Answer to Problem 8.1P
Solution:
The file is,
%MATLAB code to create a cell array and perform the operations.
%cell array file.
X = {41,'hiii', 1:4;'matlab', 10, 1:2:9}
%define a cell array.
X{randi(numel(X))}
%define the random element from the cell array.
Z = X'
%get the transpose of the cell array.
Z{randi(numel(Z))}
%define the random element from the above cell array.
%end of cell array file
%The cell array file should be placed in the same folder.
The function file is,
%MATLAB code to create a cell array and get the random element from the cell arary.
%function file.
function A = randomelement(cell)
A = cell{randi(numel(cell))};
end
%end of function file
%The function file should be placed in the same folder
Explanation of Solution
Consider the cell array is,
The random element from the above array is,
MATLAB Code:
clc
clear all
close all
%MATLAB code to create a cell array and perform the operations.
%cell array file.
X = {41,'hiii', 1:4;'matlab', 10, 1:2:9}
%define a cell array.
X{randi(numel(X))}
%define the random element from the cell array.
Z = X'
%get the transpose of the cell array.
Z{randi(numel(Z))}
%define the random element from the above cell array.
%end of cell array file
%The cell array file should be placed in the same folder.
%MATLAB code to create a cell array and get the random element from the cell arary.
%function file.
function A = randomelement(cell)
A = cell{randi(numel(cell))};
end
%end of function file
%The function file should be placed in the same folder
Save the MATLAB cell array file with name, chapter8_54793_8_1P.m and a function file with the name of randomelement.m in the current folder. Execute the function by typing the function name at the command window to generate output.
Result:
The results are,
Therefore, the results are stated above.
Want to see more full solutions like this?
Chapter 8 Solutions
MATLAB: A Practical Introduction to Programming and Problem Solving
- The p-value is the probability of a statistic being at most as extreme as the observed value when Ho is false. the probability that the alternative hypothesis is true. O the probability that the null hypothesis is true. O the probability of a statistic being at most as extreme as the observed value when Ho is true. O the probability of a statistic being at least as extreme as the observed value when Ho is true.arrow_forwardWhy the correct answer in 9b is 1/150? What is the solution to the answer?arrow_forwardHow to get the answer in question 8 letter c? What is the solution to get the answer of 12.6?arrow_forward
- The daily sales (in hundreds of dollars) for a store in one month (30 days) are: 15, 22, 18, 25, 19 12, 17, 24, 20, 23 30, 28, 26, 31, 35 21, 19, 27, 18, 20 16, 15, 32, 30, 17 24, 29, 22, 33, 25 a. Construct a grouped frequency distribution with class intervals of width 5 starting from 12. b. Draw a histogram and state whether the data is symmetric, skewed left, or skewed right. Instruction: 1. Please answer the question given above for your tutorial participation mark. 2. Please upload your hand-written answers (pdf format).arrow_forwardDon’t solve i will dislike ?arrow_forwardWhat is the difference between population and sample in statistics?arrow_forward
- Don’t solve questionarrow_forwardDon’t solve questionsarrow_forwardFred needs to choose a password for a certain website. Assume that he will choose an 8-character password, and that the legal characters are the lowercase letters a, b, c, ..., z, the uppercase letters A, B, C, ..., Z, and the numbers 0, 1, . . ., 9. (a) How many possibilities are there if he is required to have at least one lowercase letter in his password? (b) How many possibilities are there if he is required to have at least one lowercase letter and at least one uppercase letter in his password? (c) How many possibilities are there if he is required to have at least one lowercase letter, at least one uppercase letter, and at least one number in his password?arrow_forward
- Algebra & Trigonometry with Analytic GeometryAlgebraISBN:9781133382119Author:SwokowskiPublisher:CengageAlgebra: Structure And Method, Book 1AlgebraISBN:9780395977224Author:Richard G. Brown, Mary P. Dolciani, Robert H. Sorgenfrey, William L. ColePublisher:McDougal Littell

