Read Excel file with Matlab
1.054 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Palumbo Piero am 17 Nov. 2017
Kommentiert: Paruvachi Raja am 21 Jan. 2022
Hello, I have an Excel file with numbers and strings. If I use the function xlsread it gives me back only the numbers. How can I read the strings?
Michelle Hirsch am 1 Apr. 2020
Michelle Hirsch am 20 Mai 2020
I'm not sure if I know exactly what you are trying to do. My impression is that Excel doesn't actually have a concept of images in cells - images are just placed on the canvas and positioned to look like they live in cells.
Here are a couple of thoughts if you are trying to read the image data into MATLAB:
- Take advantage of the fact that Excel files are actually ZIP files. Unzip and import the images.
For instance, I made a file with two pictures. You'll see them in the xl/media file:
>> contents = string(unzip('twopictures.xlsx'))'
14×1 string array
I could then use imread to read the images, e.g.
im = imread('xl/media/image1.jpeg');
The biggest issue is I don't know how to figure out where the images were located.
- If you are on Windows, the other approach would be to use ActiveX to connect to Excel to read the images. I'm on a Mac so I haven't tried this.
Weitere Antworten (2)
KSSV am 17 Nov. 2017
Bearbeitet: KSSV am 17 Nov. 2017
[num,txt,raw] = xlsread('myfile') ;
num gives only numbers.
txt gives only text data.
raw gives the complete file.
Ijaz Younis am 6 Nov. 2019
[num,txt,raw] = xlsread('myfile')
Find more on Data Import from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!