Mathematical functions across variables

조회 수: 2 (최근 30일)
Meredith Ziliak
Meredith Ziliak 2023년 9월 18일
댓글: Stephen23 2023년 9월 19일
I have two variables saved in the workspace, A and B. Say A is 3x3 and B is 2x2. This seems so simple, but how would I add A(1,1) to B(2,1)? I can't seem to get anything to work. Thanks.
  댓글 수: 1
Stephen23
Stephen23 2023년 9월 19일
"This seems so simple, but how would I add A(1,1) to B(2,1)? I can't seem to get anything to work"

댓글을 달려면 로그인하십시오.

답변 (2개)

John D'Errico
John D'Errico 2023년 9월 18일
편집: John D'Errico 2023년 9월 18일
Is there a good reason why you would not just try this?
A(1,1) + B(2,1)
I think you are coming from a spreadsheet world. And for some reason you think MATLAB needs to operate just like a spreadsheet. Honestly, I don't know what it is you would have tried to do that operation. But I will guess you were trying to click on those elements somehow, and get an addition.

the cyclist
the cyclist 2023년 9월 18일
편집: the cyclist 2023년 9월 18일
If you just want to know their sum
A(1,1) + B(2,1)
If you want to add A(1,1) to the value stored in B(2,1)
B(2,1) = A(1,1) + B(2,1)
Given the level of your question, you would probably find the free MATLAB Onramp tutorial useful.

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by