Assign a line in every element of a 3d matrix

1 回表示 (過去 30 日間)
MD MAHABUBUR ROHOMAN
MD MAHABUBUR ROHOMAN 2022 年 10 月 14 日
回答済み: Steven Lord 2022 年 10 月 18 日
I have a 10x10x10 matrix that looks like the below attached.I want to add a line 101.543 30.453 50.185 to the ement that contains 10.
  7 件のコメント
MD MAHABUBUR ROHOMAN
MD MAHABUBUR ROHOMAN 2022 年 10 月 14 日
Actually, I do not have the exact result. That is why I am scribbling on the input picture.
The matrix that has elements of value 10, I want that value to be changed in some other string or character(i.e: 50 60 70 (this is a line not individual value) or balsal).
I do not have anything other than that. :((
James Tursa
James Tursa 2022 年 10 月 18 日
@MD MAHABUBUR ROHOMAN If you can't describe to us the specific output you want, how can we possibly know what you need?

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

回答 (2 件)

the cyclist
the cyclist 2022 年 10 月 14 日
To replace all values of 10 with 101.543, you can do
val(val==10) = 101.543;
Maybe that helps?

Steven Lord
Steven Lord 2022 年 10 月 18 日
If we look at the array you posted, what I think you want would involve the first row of page 1 of val having 10 elements and row 2 having 12 or 13 (depending on whether your three elements were inserted in place of 10 or after.) In either of those cases, that is not possible. All rows in an array in MATLAB must have the same number of columns.
But if that's not what you want, let's take a smaller example. Please show us exactly what you'd want as a result if you did your replacement on this (much smaller) matrix and tell us exactly how you got from the A matrix to that result.
A = [1 2 3; 4 10 6]
A = 2×3
1 2 3 4 10 6

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by