5 views (last 30 days)

Hi ,

I am new to MATLAB, I need help with this problem please help!

I'm trying to do this operation.

A is 256 * 1 double

B is 18 * 1 complex double

I am trying to do

A (17: 240) = B;

But I am getting this error! what might be the reason?

"In assignment A (I) = B, the number of elements in B and I must be the same."

Shubham Gupta
on 8 Nov 2019

Your:

A(17:240) % is a vector of 224 elements ((240-17+1)x1)

while

B % is a vector of 18 elements (18x1)

that's why you are getting the error

Opportunities for recent engineering grads.

Apply Today
## 3 Comments

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/489917-in-an-assignment-a-i-b-the-number-of-elements-in-b-and-i-must-be-the-same#comment_764983

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/489917-in-an-assignment-a-i-b-the-number-of-elements-in-b-and-i-must-be-the-same#comment_764983

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/489917-in-an-assignment-a-i-b-the-number-of-elements-in-b-and-i-must-be-the-same#comment_764987

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/489917-in-an-assignment-a-i-b-the-number-of-elements-in-b-and-i-must-be-the-same#comment_764987

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/489917-in-an-assignment-a-i-b-the-number-of-elements-in-b-and-i-must-be-the-same#comment_765899

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/489917-in-an-assignment-a-i-b-the-number-of-elements-in-b-and-i-must-be-the-same#comment_765899

Sign in to comment.