Write a function that receives a matrix as an input argument, and prints a random row from the matrix
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:6| Question number:9.6
All Answers
total answers (1)
printRanRow.m
function printRanRow(mat)
% Prints a random row from a matrix
% Assumes a fairly small matrix of ints
% Format of call: printRanRow(matrix)
% Does not return any values
[r c] = size(mat);
ranrow = randi([1,r]);
fprintf('%d ', mat(ranrow,:))
fprintf('\n')
end
need an explanation for this answer? contact us directly to get an explanation for this answer