Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I keep getting the same error of Variable D being the wrong size but then the size requirement will change each time. ex. [9 1]

image text in transcribed

image text in transcribed

I keep getting the same error of Variable D being the wrong size but then the size requirement will change each time. ex. [9 1] [6 1] [4 1]. It says it could be caused by numbers being hard coded in from the code to call box but I delete them and it stays the same. For Matlab grader(very specific requirements and all must be met to get credit). Thanks

function [B,C,D]=matrixFun(A) \& Replace elements less than with B=A; B(B)=sart(C(C>)); S Find elements between -2 and 2 , sort them, and store in D valid_elements =A=2&A=2; valid_values = A(valid_elements); D= sort(valid_values); D=D(1:4);% Take the first 4 sorted values \% Ensure D has a size of [41] D=reshape(D,4,1); end Code to call your function Previous Assessment: 4 of 5 Tests Passed Is output B correct for the example matrix A? (Pretest) Is output C correct for the example matrix A? (Pretest) Is output D correct for the example matrix A? (Pretest) Does function return the correct outputs for a random matrix different than what is shown in the "Code to call your function" box? If your code passed the first three tests but not this one, it could be because you hard coded the numbers in the example matrix A in the "Code to call your function" Does solution use vectorized code free of for, while, and if commands

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions

Question

Challenges Facing Todays Organizations?

Answered: 1 week ago