Array indices must be positive integers or logical values

5 ビュー (過去 30 日間)
Andrew Voges
Andrew Voges 2021 年 4 月 27 日
コメント済み: Clayton Gotberg 2021 年 4 月 28 日
I'm relatively new to MATLAB, and I'm trying to get my code to read some Excel files, but one row has negative integers. Is there any possible way to get the code to read the files properly? I'm trying to plot the results and it should look like a sine wave crossing over the x-axis, so there should be negative values... I've attached the Excel file and a screenshot of the segment of code where the error occurs.

回答 (1 件)

Clayton Gotberg
Clayton Gotberg 2021 年 4 月 27 日
I tried the same code letter for letter and I was able to make it work. Are you on the Windows OS?
Also, since you're using R2018b, try using readmatrix or readtable instead. They're both preferred over xlsread.
  2 件のコメント
Andrew Voges
Andrew Voges 2021 年 4 月 27 日
I was running it on Mac and switched to Windows and it worked! Thanks!
Clayton Gotberg
Clayton Gotberg 2021 年 4 月 28 日
It seems like xlsread has some problems with Mac OS. If you do need to use Mac for this, you should hopefully be able to do it with one of the other functions I mentioned; I'm glad switching OS was possible this time though!
If that's everything you needed, please accept my answer so I can close the book on this question!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by