フィルターのクリア

How to import exponent number from Excel column to MATLAB

1 回表示 (過去 30 日間)
Ayush Ulhas
Ayush Ulhas 2022 年 9 月 27 日
コメント済み: Walter Roberson 2022 年 9 月 27 日
I have a list of numbers in excel column. I am looking to extract the exponent number (+ - symbol doesn't matter)
For example, in 2^-6 => I want '6'
in 2^-4 => I want '4'
Thank you for any help you can provide.

回答 (1 件)

Chunru
Chunru 2022 年 9 月 27 日
x = readtable("2powx.xlsx")
x = 5×1 table
LSB _________ {'2^-6' } {'2^-7' } {'2^-8' } {'2^-9' } {'2^-10'}
y = cellfun(@(a) sscanf(a, "%d^%d")', x.LSB, "UniformOutput", false)
y = 5×1 cell array
{[ 2 -6]} {[ 2 -7]} {[ 2 -8]} {[ 2 -9]} {[2 -10]}
y = cell2mat(y)
y = 5×2
2 -6 2 -7 2 -8 2 -9 2 -10
y = y(:, 1).^y(:, 2)
y = 5×1
0.0156 0.0078 0.0039 0.0020 0.0010
  2 件のコメント
Ayush Ulhas
Ayush Ulhas 2022 年 9 月 27 日
Thank you for the help! May I know how to do the same process if the LSB values are in column 'G' and start from row '4'
Walter Roberson
Walter Roberson 2022 年 9 月 27 日
You can specify a 'Range' option to readtable()

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by