importing excel sheet in matlab

4 ビュー (過去 30 日間)
ali hassan
ali hassan 2022 年 2 月 9 日
コメント済み: ali hassan 2022 年 2 月 11 日
i just imported an excel sheet in matlab. Then i selected a vector column and loaded it from excel sheet. but data was disorganised as you can see that first entry is different. and why the values are displayed with 2.23e+03 but not like 22300.

採用された回答

stefan
stefan 2022 年 2 月 9 日
Hi,
You're not looking at the top of your column in the command window. As far as I know, the scroll buffer is per default limited to 5000 lines and your table has 100832 rows... hence, your about 95832 lines short with your scroll buffer.
Long story short: It is there but it is just not visualised in the command window. Btw: A good indicator is that the command you've entered to show the first column is also not shown anymore.
As for the display of your values (3.2e+03). This is just the engineering number format. You could change that (see: https://ch.mathworks.com/help/matlab/ref/format.html) but it doesn't change your data or how Matlab calculates with it.
Best,
Stefan

その他の回答 (2 件)

ali hassan
ali hassan 2022 年 2 月 10 日
the values in table and command window are totally different though i changed the style.
  2 件のコメント
stefan
stefan 2022 年 2 月 10 日
It is hard to tell from your picture, but still I believe that you're not looking at the top line in the Command Window. Try e.g:
t(1,11)
This gives you the first row and 11th column of the table (there are other ways to access the table, e.g. by the var-name). If you then compare what you see in the table (upper portion of your screen) and in the command window (lower portion of your screen) you should see that they match.
If you still think it is wrong, then you should provide the code and the table you're using.
Best,
stefan
ali hassan
ali hassan 2022 年 2 月 11 日
thanks i tried and its working perfectly fine

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


ali hassan
ali hassan 2022 年 2 月 10 日
my excel file is as atttached. when i view it in table, it shows in e form but when i load (HYD1_psi_ ) column in command window, it gives value in decimal which is not equal to table.
  2 件のコメント
stefan
stefan 2022 年 2 月 10 日
Yes they are absolutely identical...
The following picture is from when I import the table in Matlab and access the same cell as you mentioned before (HYD1psi, first entry). As you can see, I can set the format to whatever I want and like. The value of the cell, however, is absolutly identical in every case.
When you access a full column with command window, as shown in the next picture, matlab will print out all the values of this column (try it with t.HYD1psi). You will see that matlab prints it out sequentially and your window starts to move down. When 5000lines are written (default value) the first line that has been written will no longer be in the command window (it has not infinit memory either) and drops out. That doesn't mean that the value has been deleted or changed, it is just not shown anymore. Since your table is quite large it can't be shown all at once in the command window.
As you can see at (1), I'm at the top of the command window, and at (2) I can't even see the command I've used to open the column. The top value you see there is just one of the last (5000) values that have been printed.
Best,
Stefan
ali hassan
ali hassan 2022 年 2 月 11 日
what if i want that when i load the excel file, it also loads all the vector columns instead of loading each column one by one?can it be done?

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by