Index exceeds matrix dimensions Economic Model
Ältere Kommentare anzeigen
Hello everybody, I have a question. Perhaps any of you could be kind enough to help me. It has to do with the firing part of my model:
- f=randperm(length(workforce));
- f=f(1:-vacancies(i));
Now normally what happens you get something like this: (when there are 2 vacancies for i(the firm)):
- f=[3,2,3,4,12];
- f=f(1:--2)
And it returns: [3,2], so that these are both fired. However I am adjusting the model and now I have a situation where it’s possible that: (still when there are 2 vacancies)
- f=[3];
- f=f(1:--2)
And it doesn’t work, because there aren’t 2 to fire. Therefore I get an error: Index exceeds matrix dimensions. Instead I would like the model to fire the one and leave the other vacancy unfulfilled. I have been wrapping my head around this and would appreciate any suggestions!
Thanks in advance!
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Matrix Indexing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!