how to fprintf element in matrix using array without using loops

 採用された回答

Ameer Hamza
Ameer Hamza 2020 年 12 月 2 日

0 投票

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 件のコメント

Jit Mun Wong
Jit Mun Wong 2020 年 12 月 2 日
thanks a lot man
Ameer Hamza
Ameer Hamza 2020 年 12 月 2 日
I am glad to be of help!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by