Why I got the error "Operator '-' is not supported for operands of type 'struct'."?
조회 수: 55 (최근 30일)
이전 댓글 표시
My code
%Convert from Fahrenheit to Kelvin
TempK = ((X(:,1)-32)*5/9)+273.15;
댓글 수: 6
채택된 답변
Cris LaPierre
2020년 5월 8일
편집: Cris LaPierre
2020년 5월 8일
When importing a spreadsheet, importdata returns a scalar structure array (see here). Your error, then, is because you are not accessing the data properly (see examples on the page I linked to).
Is there a reason you are using this import function? I'd suggest using readtable instead. You will have to learn how to access data in a table as well. I'd suggest this short video.
댓글 수: 0
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!