Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi, I have a quesiton about using Matlab. So I\'m suppose to import a matrix \'A

ID: 3600796 • Letter: H

Question

Hi, I have a quesiton about using Matlab. So I'm suppose to import a matrix 'A' that I downloaded from canvas (On teacher's instruction) and use that matrix to solve problems via Matlab. So I imported the download onto matlab, and it shows on the workspace like 'A' = . But when I try to run a command like cumsum or sum on matrix 'A', the matrix 'A' disapears and it gives me an error 'undefined variable'. How do i fix it? I made a zip file and imported both my script and the downloaded matrix 'A' so far, but that didn't work.

Explanation / Answer

Solution:

There is a number of reasons which are creating this problem.

First and foremost is whether your script contains commands name clear;

This command clears all the memory occupation in the workspace.

Another reason could be that your functions have their own workspaces and when you exit a function, everything in its workspace disappears. Your function seems to read the matrix but is apparently not passing those contents back to your calling program for it to use.

I have provided this answer to the best of my ability if your problem is still not solved, please comment below. We will sort this out.

I hope this helps, please let me know in case of any doubt.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote