[NUMBER,STRING,EVERY]=xlsread("C:\Users\lenovo\Desktop\Sep_2020_Ericsson.xls")
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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
0 Kommentare
Antworten (1)
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
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
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!