[NUMBER,ST​RING,EVERY​]=xlsread(​"C:\Users\​lenovo\Des​ktop\Sep_2​020_Ericss​on.xls")

1 Ansicht (letzte 30 Tage)
Hi all
Kindly help .
I have excel file , and I riun this :
[NUMBER,STRING,EVERY]=xlsread("C:\Users\lenovo\Desktop\Sep_2020_Ericsson.xls")
now, when I run EVERY in command windows , it shows me data like this :
{'Z78NJ037' } {[ 21.93001667]} {[ 39.12541667]}
{'Z78NJ037' } {[ 21.93001667]} {[ 39.12541667]}
{'Z78NJ037' } {[ 21.93001667]} {[ 39.12541667]}
{'Z78NJ851' } {[ 21.5754]} {[ 39.15138333]}
{'Z78NJ851' } {[ 21.5754]} {[ 39.15138333]}
{'Z78NJ851' } {[ 21.5754]} {[ 39.15138333]}
i want to remove the {', and [ .... i want to read directly strings like Z78NJ851, 21.93001667....
How can I reference directly the values of Z78NJ851, or 21.93001667 ..??
Thanks

Antworten (1)

Walter Roberson
Walter Roberson am 23 Jan. 2021
The { [ are display artifacts. For example you can
disp(EVERY{1,1})
and you will observe that those and the ' characters are not actually stored.
I recommend that you switch to using readtable()
  4 Kommentare
Tareq Rahmani
Tareq Rahmani am 23 Jan. 2021
i didn't get you.
What is the best solution if I want to process an excel file that have 1048576 rows ?
Which one is best :
1- distributed(datastore(excelFileName));
2- tall(datastore(excelFileName));
3- xlsread()
4- readtable
thanks very very much
Walter Roberson
Walter Roberson am 23 Jan. 2021
If you have exactly one such file, it is likely that readtable() is best. However, I have seen some reports that current readtable() might be considerably slower for large files than using xlsread() is. If you are using more complicated data types such as dates, then readtable() often makes your life a lot easier.
If you do need to use xlsread() then
names = EVERY(:,1);
value1 = cell2mat(EVERY(:,2));
value2 = cell2mat(EVERY(:,3));
and remember that there is a difference between how cells are displayed and what they store, so while
names(1:3)
might display as
{'Z78NJ037' }
{'Z78NJ037' }
{'Z78NJ037' }
the { and } characters are not part of what is really stored, and you can get at what is really stored using {} indexing, like names{1} would be the character vector Z78NJ037

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by