Unable to find file , load file to xl file .

2 ビュー (過去 30 日間)
Md. Mohidul Islam
Md. Mohidul Islam 2023 年 1 月 13 日
編集済み: Stephen23 2023 年 1 月 14 日
  1 件のコメント
Stephen23 2023 年 1 月 14 日
編集済み: Stephen23 2023 年 1 月 14 日
Do NOT store user files in the installation directory of any application!
'C:\Program Files\MATLAB\R2022b\bin\my_excel_file.xls' % !!! DO NOT use this location !!!
Your Windows should protect the installation folder, so whatever you are doing ... is best avoided.


回答 (1 件)

Voss 2023 年 1 月 13 日
Two things:
1) You're using
y1 = xlsread('F:\matlab\bin_my_excel_file');
% ^ underscore
but 'bin' is a directory and the file is (supposedly) 'my_excel_file', so that should be
y = xlsread('F:\matlab\bin\my_excel_file');
% ^ backslash
2) Specify the file name completely, including the extension, either .csv or .xls. I don't know which one you mean because they both exist.
% which file?
% this one:
y1 = xlsread('F:\matlab\bin\my_excel_file.csv')
% or this one:
y1 = xlsread('F:\matlab\bin\my_excel_file.xls')
Also, readmatrix, readtable, and readcell are recommended over xlsread in R2022b.
You can pick the one that makes the most sense for the class of the variable that should represent the contents of the file (a matrix, a table, or a cell array, respectively).
  4 件のコメント
Voss 2023 年 1 月 13 日
@Md. Mohidul Islam: Do you have another question about the code you posted? If you want someone to be able to run it, they'd need to have the required files, including:
C:\Program Files\MATLAB\R2022b\bin\my_excel_file.xls



Help Center および File ExchangeDescriptive Statistics についてさらに検索





Community Treasure Hunt

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

Start Hunting!

Translated by