Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Type your question he I don\'t want C language. I need matlab code! Write the fu

ID: 3528705 • Letter: T

Question

Type your question he

I don't want C language. I need matlab code!

Write the function convert_to_numbers() that takes in an array of Booleans and returns an array of the numbers that correspond to the indices that are associated with true values. Examples:

a = [ true, false, true, false ]; % the 1st and 3rd locations are true, so returns [1, 3]

convert_to_numbers( a )

ans =

1 3

a = [ false, false, false, true, true, true ];

convert_to_numbers( a ) % 4th, 5th, and 6th locations are true, so returns [4, 5, 6]

ans =

4 5 6

a = [ false, false, false ];

convert_to_numbers( a ) % No values are true, thus the empty array is returned.

ans =

[] <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /?>


Explanation / Answer

TTT