Problem reading double array from excel

14 ビュー (過去 30 日間)
Daniel
Daniel 2022 年 11 月 4 日
コメント済み: Daniel 2022 年 11 月 4 日
Hi, Im reading data from a excel file and I have a few strings that I need to read it as double and I cant, I tried converting the cell to string and then to double and more options but the result are NaN or not a double. Here is what I need to do:
Here I have the excel value
This is how I read all this value and the others (the other values are just normal numbers, so I dont have problems)
This is what I want to do
Thank you for the help

採用された回答

Stephen23
Stephen23 2022 年 11 月 4 日
編集済み: Stephen23 2022 年 11 月 4 日
READCELL et al import text as text, not as double. You could use STR2NUM on the text:
C = readcell(..)
N = str2num(C{1})
  2 件のコメント
Stephen23
Stephen23 2022 年 11 月 4 日
str2num('[0:100:100000]')
ans = 1×1001
0 100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2100 2200 2300 2400 2500 2600 2700 2800 2900
Daniel
Daniel 2022 年 11 月 4 日
Ok, that works, I tried str2double (I think is the same) but without the {1}, thank you.

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

その他の回答 (1 件)

KSSV
KSSV 2022 年 11 月 4 日
REad about readtable
  2 件のコメント
Daniel
Daniel 2022 年 11 月 4 日
I tried with readtable and readmatrix but not working.
KSSV
KSSV 2022 年 11 月 4 日
Attach your excel file.

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

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by