how to fprintf element in matrix using array without using loops
조회 수: 10 (최근 30일)
이전 댓글 표시
A=randi([-5,5],2,2)
B=randi([-10,10],3,4)
K=kron(A,B);
a=1:6
a2=1:8
fprintf('K(%.0f,%.0f) is %.1f\n',a,a2,K(a,a2))
댓글 수: 0
채택된 답변
Ameer Hamza
2020년 12월 2일
Like this
A=randi([-5,5],2,2);
B=randi([-10,10],3,4);
K=kron(A,B);
a=1:6;
a2=1:8;
[ag,a2g] = ndgrid(a,a2);
fprintf('K(%.0f,%.0f) is %.1f\n',[ag(:).'; a2g(:).'; K(:).'])
댓글 수: 2
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!