unable read any ".xlsx" or ".xls" data

它無法讀取任何“ .xlsx”或“ .xls”數據。它甚至沒有報告命令窗口中的任何錯誤,而是當我雙擊其中任何一個時發出的簡單聲音。我使用win10,MATLAB2020b,office 2013。
我已經從MATLAB獲得了所有工具箱。並且Excel可以正常工作。這些“ .xlsx / .xls”可以“在matlab外部打開”,並且在以下情況下可以使用:
readtable('path_to.xlsx','Sheet','sheet_name')
如果我不僅要在命令窗口中打開表,而且要直接在MATLAB中打開“ .xlsx / .xls”,該如何解決?

10 commentaires

Rik
Rik le 17 Nov 2020
(approximate translation:)
It cannot read any ".xlsx" or ".xls" data. It didn't even report any errors in the command window, but a simple sound when I double-clicked any of them. I use win10, MATLAB2020b, office 2013.
I have obtained all toolboxes from MATLAB. And Excel can work normally. These ".xlsx/.xls" can be "opened outside matlab" and can be used in the following situations:
readtable('path_to.xlsx','Sheet','sheet_name')
If I not only want to open the table in the command window, but also directly open ".xlsx / .xls" in MATLAB, how can I solve it?
Rik
Rik le 17 Nov 2020
What do you want to do? Do you want to read the Excel file as a cell array? Do you want to edit the Excel file directly from the variable editor?
Yu Jui Huang
Yu Jui Huang le 18 Nov 2020
Hello Rik, It is my grace to get your reply. I want to edit the Excel file directly from the variable editor ( I need to edit these ".xlsx/.xls" in MATLAB directly if possible. Not only read them in command window or save as ".csv".)
Rik
Rik le 18 Nov 2020
You can't directly edit the excel file in Matlab. You can read and write to a file with xlsread and xlswrite.
Yu Jui Huang
Yu Jui Huang le 18 Nov 2020
Thank you Rik. Please check my picture of my screen shoot. I can't load them in MATLAB.
Yu Jui Huang
Yu Jui Huang le 18 Nov 2020
I can pick data out with "readtable". These data also can be read in Excel. That is not enough for me to learn MATLAB unless I can load them in MATLAB :'(
KALYAN ACHARJYA
KALYAN ACHARJYA le 18 Nov 2020
Once you try to load with xlsread(''), is there any issue?
Yu Jui Huang
Yu Jui Huang le 18 Nov 2020
There are no error when I used xlsread.
Yu Jui Huang
Yu Jui Huang le 18 Nov 2020
It is OK with ".csv".
I need to import "xls/xlsx" like that but it can't. It is unable to read (or import) like the form of excel in MATLAB, without any message of error.
Rik
Rik le 18 Nov 2020
From your screenshot it looks like xlsread works normally.
You should not confuse the import tool with actually editing the file.
Have you done a Matlab tutorial? You may consider doing the Onramp tutorial (which is provided for free by Mathworks). It should teach you the basics. I'm not sure if there is an excersize with loading and writing excel files, but there might be.

Connectez-vous pour commenter.

Réponses (1)

Sukrut Tamhankar
Sukrut Tamhankar le 20 Nov 2020

0 votes

As per my understanding, you are expecting to edit excel file from the MATLAB directly. Please refer the following example which shows how to use a COM Automation server to access another application from MATLAB. It creates a user interface to access the data in a Microsoft Excel file:
This technique can help you to edit data in the excel file and save it back to the file through MATLAB.
You can find the answer to the similar query in the following MATLAB Answer link in which the same technique is used :
Whereas, Import tool or import functions enable you to read the data from excel file in the MATLAB.

Community Treasure Hunt

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

Start Hunting!

Translated by