Comments on: MATLAB: In an assignment A(I) = B, the number of elements in B and I must be the same. https://blogs.mathworks.com/videos/2014/11/20/matlab-in-an-assignment-ai-b-the-number-of-elements-in-b-and-i-must-be-the-same/?s_tid=feedtopost Stuart uses video to share his experiences solving problems with MATLAB day-to-day, interesting new features, plus tips and tricks he has picked up along the way. Wed, 26 Jun 2019 05:10:01 +0000 hourly 1 https://wordpress.org/?v=6.2.2 By: Nihal Singh https://blogs.mathworks.com/videos/2014/11/20/matlab-in-an-assignment-ai-b-the-number-of-elements-in-b-and-i-must-be-the-same/#comment-99580 Wed, 26 Jun 2019 05:10:01 +0000 https://blogs.mathworks.com/videos/?p=1538#comment-99580 The above article and the videos are very helpful for the students to write the best assignments and the Matlab. Thanks for sharing the idea.

]]>
By: Bhakti Kaushal https://blogs.mathworks.com/videos/2014/11/20/matlab-in-an-assignment-ai-b-the-number-of-elements-in-b-and-i-must-be-the-same/#comment-89528 Wed, 13 Feb 2019 06:19:30 +0000 https://blogs.mathworks.com/videos/?p=1538#comment-89528 Very helpful video.. I am trying to run something like this in a for loop and getting the same error in second iteration, understood my mistake and I can now solve..
Thanks :)

]]>
By: Stuart McGarrity https://blogs.mathworks.com/videos/2014/11/20/matlab-in-an-assignment-ai-b-the-number-of-elements-in-b-and-i-must-be-the-same/#comment-84815 Mon, 01 Oct 2018 18:06:33 +0000 https://blogs.mathworks.com/videos/?p=1538#comment-84815 Hi Tahseen, You need to look at the dimensions of A(I) and B to make sure they are the same. Stop in the debugger it you need to.

]]>
By: tahseen alshmary https://blogs.mathworks.com/videos/2014/11/20/matlab-in-an-assignment-ai-b-the-number-of-elements-in-b-and-i-must-be-the-same/#comment-84797 Sun, 30 Sep 2018 22:08:50 +0000 https://blogs.mathworks.com/videos/?p=1538#comment-84797 i do that but the error stay same
is there another solution

]]>
By: Stuart McGarrity https://blogs.mathworks.com/videos/2014/11/20/matlab-in-an-assignment-ai-b-the-number-of-elements-in-b-and-i-must-be-the-same/#comment-61643 Sun, 01 May 2016 19:24:25 +0000 https://blogs.mathworks.com/videos/?p=1538#comment-61643 Hi Vijay, The error Doug describes is caused by a variable changing dimensions during the running of the code. Your line, newfinal(i) = final + a(i-1), on its own could not cause this type of error.

Are you still getting an error? Have you tried dbstop on error and looking at the variables?

]]>
By: vijay https://blogs.mathworks.com/videos/2014/11/20/matlab-in-an-assignment-ai-b-the-number-of-elements-in-b-and-i-must-be-the-same/#comment-60959 Sat, 02 Apr 2016 14:40:37 +0000 https://blogs.mathworks.com/videos/?p=1538#comment-60959 Ok, generally, nobody makes this exact error. The general error would be more like: newfinal(i) = final + a(i-1); Something like this blows up and it doesn’t make any sense. In my case: inputfile(i) = [path file(i)]; gives me this error. I am trying to place each entry of fetched file (from uigetfile) into an array of inputfile. Why does this generate an error?

]]>
By: Stuart McGarrity https://blogs.mathworks.com/videos/2014/11/20/matlab-in-an-assignment-ai-b-the-number-of-elements-in-b-and-i-must-be-the-same/#comment-56346 Fri, 09 Oct 2015 13:53:18 +0000 https://blogs.mathworks.com/videos/?p=1538#comment-56346 Hi Tobi,

When are you not seeing a line number in the error? If you are selecting and evaluating some lines of code or you are using the “run section” feature you will not get a line number. Otherwise you should.

]]>
By: Tobi https://blogs.mathworks.com/videos/2014/11/20/matlab-in-an-assignment-ai-b-the-number-of-elements-in-b-and-i-must-be-the-same/#comment-56337 Fri, 09 Oct 2015 09:29:45 +0000 https://blogs.mathworks.com/videos/?p=1538#comment-56337 This error message would be waaaaaaaay more helpful if it gave a line number, just like any other error message does!

Tobi

]]>
By: Kate https://blogs.mathworks.com/videos/2014/11/20/matlab-in-an-assignment-ai-b-the-number-of-elements-in-b-and-i-must-be-the-same/#comment-52760 Mon, 25 May 2015 15:14:11 +0000 https://blogs.mathworks.com/videos/?p=1538#comment-52760 Thank you. I just want to express my deep appreciation to this video. This is very helpful to me in identifying the real problem behind the error report. The ‘dbstop if error’ command is powerful. Thank you again. Cheers.

]]>