Add dimensions to a matrix

2 ビュー (過去 30 日間)
Prerna Mishra
Prerna Mishra 2022 年 7 月 1 日
編集済み: Matt J 2022 年 7 月 1 日
My RHSvec is a 51X21 matrix. kdpolind is 11X51X21. Doing the following:
[RHSval,kprimeind] = max(RHSvec,[],2);
gives me a 51X1 RHSval and a 51X1 kprimeind.
if kprimeind is as follows:
16
20
20
16
20
16
16
then I want to store in kprimeind in kdpolind as
kdpolind(act,1,16)
kdpolind(act,2,20)
kdpolind(act,3,20)
kdpolind(act,4,16)...
I am unable to do this due to dimensions mismatch. Is there a simple way of doing this?
Thanks!

回答 (1 件)

Matt J
Matt J 2022 年 7 月 1 日
編集済み: Matt J 2022 年 7 月 1 日
[RHSval,kprimeind] = max(RHSvec,[],2,'linear');
kdpolind(act,kprimeind)= vector_that_is_51x1

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by