[NUMBER,STRING,EVERY]=xlsread("C:\Users\lenovo\Desktop\Sep_2020_Ericsson.xls")
Mostra commenti meno recenti
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
Risposte (1)
Walter Roberson
il 23 Gen 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 Commenti
Tareq Rahmani
il 23 Gen 2021
Walter Roberson
il 23 Gen 2021
Modificato: Walter Roberson
il 23 Gen 2021
That is an invalid xls file. xls files get corrupted if they have more than 65536 lines.
xlsx files support up to 1048576 rows, which is less than what you have, so you will not be able to use xlsx files either (not unless you use multiple sheets)
Tareq Rahmani
il 23 Gen 2021
Walter Roberson
il 23 Gen 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
Categorie
Scopri di più su MATLAB in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!