When make the efforts to do a regression duty by using a role that is manually created, I have actually this error alerting: In one assignment A(:) = B, the number of elements in A and B should be the same.

You are watching: In an assignment a(:) = b, the number of elements in a and b must be the same.

The password I have are contained below(ols is a function created through me) and I to be pretty certain it is no the problem in the function.


Separate from my answer, i recommend friend re-think her storage variables. The means you index into estimates and the rather looks like your room creating range in i m sorry to save the results, however then you also append those outcomes to a different array. You don"t should do both and saving them through indices is much far better because it permits you come pre-allocate the array.
You have the right to shorten this by reversing the stimulate of the loop. The way, the first pass with the loop renders the full size variety results and MATLAB doesn"t invest time resizing the array each time. In the prior example we achieved the same result by pre-allocating v nan.

It look at like among the outputs of your duty ols is not a scalar. The error you room seeing is the very same as if friend executed


Community treasure Hunt

Find the prizes in MATLAB central and discover how the community can assist you!

start Hunting!

An Error Occurred

Unable to complete the activity because of changes made come the page. Reload the web page to see its to update state.


choose a net Site

Choose a web site to acquire translated contents where available and see regional events and offers. Based upon your location, us recommend the you select: .

pick web site

How come Get finest Site Performance

Select the China website (in Chinese or English) for best site performance. Other sommos.net nation sites are not optimized for visits from her location.

See more: Los Angeles, Ca 90023 - Grande Vista, 720 S Grande Vista Ave, Los Angeles, Ca 90023


Accelerating the speed of engineering and science

sommos.net is the top developer the mathematical computer software because that engineers and also scientists.