substitute a symbol instead of zeros in a matrix

5 ビュー (過去 30 日間)
Sravan Kumar
Sravan Kumar 2016 年 4 月 4 日
回答済み: Walter Roberson 2016 年 4 月 4 日
i have matrix a=[3 5 0;2 0 5;1 0 0] now i want to replace all zeros with any symbols. for example i need output as a=[3 5 *;2 * 5;1 * *]

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 4 月 4 日
That cannot be done in a numeric array. You can create a string with that content or you can display to the screen (or file) in the form you want, or you can create a cell array of strings that have '*' in those positions -- but you cannot create a numeric array like that.

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by