フィルターのクリア

Create matrix with elements f m file

1 回表示 (過去 30 日間)
zina ben
zina ben 2012 年 7 月 18 日
hi, i need to disp may result like this load('matrix.m') but have not all elements of matrix nxn
exemple1 n=3
3
23,90,54
786,67,75
help me.thanks in advance. if theu have other way please sed to me in may email

回答 (1 件)

Walter Roberson
Walter Roberson 2012 年 7 月 18 日
sprintf() with a %.2e format. Extract the portion of the result from the 'e' onward, discard the 'e', and remove the leading 0's from the exponent (the exponent will be either 2 or 3 digits depending on the operating system.) Make sure you keep a 0 if the overall exponent was exactly 0. Paste the resulting reformatted exponent on to the end of the formatted number, with 'x10' in-between.
  2 件のコメント
zina ben
zina ben 2012 年 7 月 19 日
編集済み: zina ben 2012 年 9 月 19 日
but i have smale problem1
i do not know how can i write this in may programme
because i have more equation and result is a big matrix
exemple
if may matrix is in order 1x6
[-0.0050 0.0177 0.0042 0.0083 -3.1187 -2.1764]
thanks in advance
Walter Roberson
Walter Roberson 2012 年 7 月 19 日
T = cellstr( num2str( YourMatrix(:), '%.2e') );
Now apply the string manipulation to each string in the cell array T, T{1}, T{2} and so on. Afterwards put the strings together as needed.
Hint: regexprep() can help with the string processing.

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

カテゴリ

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