Copy many to one elements within arrays
이전 댓글 표시
If I execute:
x = zeros(1,5);
x([1, 2, 3, 1, 4, 5]) = (1:6);
then I get x = (4, 2, 3, 5, 6). Here x(1) is written twice. And the second write takes precedence. My question: " Is it guaranteed that the write corresponding to last occurrence of an index takes precedence? ". I can imagine that on some platforms, copying may be implemented in reverse order, and I would get different results. In my application, I need to ensure a particular deterministic behavior, but I also need to be as efficient as possible.
댓글 수: 1
Guillaume
2014년 11월 20일
I don't think it's documented anywhere, so the best thing would probably be to raise a support ticket with mathworks to get an official answer.
답변 (1개)
Azzi Abdelmalek
2014년 11월 20일
0 개 추천
What platforms? It appears that Matlab will assign values in ascending order
댓글 수: 2
Raghavan
2014년 11월 20일
Azzi Abdelmalek
2014년 11월 20일
편집: Azzi Abdelmalek
2014년 11월 20일
I don't think that how Matlab does assignment depends on other platforms.
카테고리
도움말 센터 및 File Exchange에서 Elementary Math에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!