Should Behavior of sub2ind() be Different for Symbolic and Numeric Inputs?

조회 수: 2 (최근 30일)
Paul
Paul 2021년 6월 22일
댓글: Paul 2022년 5월 25일
maxrows = 1; r = 1; a = 1; c = 1; ii = false;
D = zeros(3,3,maxrows) % D is a double
D = 3×3
0 0 0 0 0 0 0 0 0
D(sub2ind([3,3,maxrows],a(ii),a(ii),r(ii))) = c(ii)
D = 3×3
0 0 0 0 0 0 0 0 0
D = zeros(3,3,maxrows,'sym') % now D is a sym
D = 
D(sub2ind([3,3,maxrows],a(ii),a(ii),r(ii))) = c(ii)
D = 
Why does sub2ind() change the dimension of D in the latter case?
  댓글 수: 1
Paul
Paul 2022년 5월 25일
Fixed in 2022a
maxrows = 1; r = 1; a = 1; c = 1; ii = false;
D = zeros(3,3,maxrows) % D is a double
D = 3×3
0 0 0 0 0 0 0 0 0
D(sub2ind([3,3,maxrows],a(ii),a(ii),r(ii))) = c(ii)
D = 3×3
0 0 0 0 0 0 0 0 0
D = zeros(3,3,maxrows,'sym') % now D is a sym
D = 
D(sub2ind([3,3,maxrows],a(ii),a(ii),r(ii))) = c(ii)
D = 

댓글을 달려면 로그인하십시오.

채택된 답변

Divija Aleti
Divija Aleti 2021년 7월 6일
Hi Paul,
The development team is working on resolving this issue. A task has been created for our development team about the bug report.
Thank you for your understanding and you will definitely be notified once the this issue is resolved.
Regards,
Divija

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by