Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Matrix Dimension error with no clear source
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi! I'm basically brand new to MATLAB and have written a rather lengthy code for a series of ODEs (currently using ode15s as a solver, but have tried others) and my code will only run for a t-span of exactly 33 seconds (probably some decimal beyond 3e), but I want it to run for a t-span of at least 100.
At some point around that 33 mark I get an error of:
Matrix dimensions must agree.
Error in Remyelination_analysis (line 65)
difference = dataDisease - dataHealthy;
The "difference" is a global variable referring to a matrix made by subtracting the two other matrices seen above. If I'm right it's claiming the matrices end up different sizes and that's why it is stopping, but they should all be the exact same size! They all have the same variables in them, but the two matrices being subtracted would have different amounts of zeroes as variables if that makes any difference.
I've checked the workspace and all three matrices are popping up at different sizes"
303x404 double, 339x404 double, and 301x404 double
Any ideas on what to try would be great! Changing my ODE solver doesn't do the trick. ode23tb seemed to be working best, but it eventually got stuck and I had to cancel the run.
Thanks!
0 comentarios
Respuestas (1)
Matt J
el 6 de Sept. de 2016
Editada: Matt J
el 6 de Sept. de 2016
Well, I think you've answered your own question. You've confirmed that the matrices have different sizes, so the source of the matrix dimension error is quite clear. You should go to the lines where dataDisease and dataHealthy are created and set Conditional Breakpoints to trap the cases where their sizes are incorrect.
2 comentarios
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!