フィルターのクリア

Change order of columns in a matrix.

1 回表示 (過去 30 日間)
BdS
BdS 2019 年 8 月 30 日
コメント済み: BdS 2019 年 8 月 30 日
Hi there,
I have got a 17x265 doube matrix with name weights.
Each row has a sum of 100.
I changed the order of columns with a variable ind (1x265 double) with numbers ranging from 1 to 265 in a specific order (i.e. [5 6 265 210...]) with the following code:
weightsNew=weights(:,ind)
The thing is now: If I sum each row, the sum isn't 100 anymore.
Does the above mentioned code change the numbers of matrix weights when I change the order of rows and save it in weightsNew?
  2 件のコメント
Stephen23
Stephen23 2019 年 8 月 30 日
"Does the above mentioned code change the numbers of matrix weights when I change the order of rows and save it in weightsNew?"
It is possible that ind has repeated/ missing indices, which could then change the row sums. If you upload the data then we can look at this. No data = very difficult for us to help you.
BdS
BdS 2019 年 8 月 30 日
Hi Stephen
thanks for your reply.
Indeed ind had 1 repeated value.
thanks for your help

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by