could anyone help me please
Show older comments

anyone can help me why is this error happened? and why do variable a and b have different matrix result?
5 Comments
John D'Errico
on 9 Mar 2018
Edited: John D'Errico
on 9 Mar 2018
Do you seriously expect anyone to be able to read what you have posted? Could you not have posted the ACTUAL text of your code, and then the actual error message, as text, pasted in?
Rik
on 9 Mar 2018
When you edit your question, be sure to attach the relevant files so we can run you code with realistic data. And are you 100% sure that b will always have 365 elements?
Ardi Nur Armanto
on 9 Mar 2018
Edited: Geoff Hayes
on 9 Mar 2018
Ardi Nur Armanto
on 9 Mar 2018
Geoff Hayes
on 9 Mar 2018
Ardi - put a breakpoint at the line
data(i,:)=x1(a(b),:);
and run your code. Look at the dimensions of data and that of x1 and in particular x1(a(b),:). Given the sizes of the source and target, does this line of code make sense?
Answers (1)
Steven Lord
on 9 Mar 2018
0 votes
Your array bb has two or more elements that are exactly equal to the minimum value. That means b will have two or more elements and so will a(b). You're trying to assign multiple rows of x1 into one row of the variable named data, and that won't work. You can't fit two dozen eggs into an egg carton designed to hold one dozen (at least not intact.)
You probably want to call min on bb with two outputs and use the second output of that call as the index into a.
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!