- https://www.mathworks.com/help/matlab/ref/xlsread.html?s_tid=srchtitle_support_results_1_xlsread
- https://www.mathworks.com/help/matlab/ref/readmatrix.html?s_tid=srchtitle_support_results_1_readmatrix
how to read values from exel sheet and do multiplication in matlab
조회 수: 2 (최근 30일)
이전 댓글 표시
How can I load values from exel sheet,it has values such as -21.2234.... these values after reading from exel sheet, should be multiplied with a matrix and then the result should be written to exel sheet.. Can somebody help me with the code please..
댓글 수: 0
답변 (1개)
TED MOSBY
2025년 7월 3일
Hi,
You can use "xlsread" for MATLAB versions before R2019a and "readmatrix" for versions starting R2019a as "xlsread" is not recommended starting R2019a.
Here is an example snippet for your reference:
inFile = 'input_example.xlsx';
inSheet = 'RawData';
M = [0.5 -1 ; 1.2 0.3 ; 0 0.8];
A = readmatrix(inFile, 'Sheet', inSheet);
R = A * M;
writematrix(R, inFile, 'Sheet', 'Results', 'Range', 'A1');
Here is more info on "readmatrix" and "xlsread" :
Hope this helps!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!