Hi, i want to read values fron excle file my code, but when i use format short it reads 1.6 as 2.0 so no.

1 回表示 (過去 30 日間)
vandana
vandana 2015 年 7 月 21 日
編集済み: dpb 2015 年 7 月 22 日
I have used format Bank in that case it reads 1.6 as 1.6 but in that case my format for whole code becomes as "format Bank". I want that use format Bank only to read excel file and then after that format short.
please help

回答 (1 件)

dpb
dpb 2015 年 7 月 21 日
It has no bearing on computations nor internal representation nor the results of reading an Excel spreadsheet.
format Set output format.
format with no inputs sets the output format ...
format does not affect how MATLAB computations are done. Computations
on float variables, namely single or double, are done in appropriate
floating point precision, no matter how those variables are displayed.
...
format may be used to switch between different output display formats
...
If you want a particular output format, use sprintf or num2str with the formatting string you want, specifically.
  2 件のコメント
vandana
vandana 2015 年 7 月 22 日
Hi when I am taking input from keyboard code is running perfectly. but whenever taking input thro. excel it gives NAN
dpb
dpb 2015 年 7 月 22 日
編集済み: dpb 2015 年 7 月 22 日
Show your work; can't say anything from that description alone. Also need to attach the input file.
PS. Pare the sample code down to just the minimum that illustrates the problem you seem to be having with the input so that other volunteers here don't have to wade thru a bunch of superfluous stuff; another benefit of doing so besides the thoughtfulness of others is that oftentimes one finds that in making this sample case one discovers the difficulty on one's own...

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

カテゴリ

Help Center および File ExchangeData Export to MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by