How do I make my script / function actually do something?
Afficher commentaires plus anciens
I'm running MATLAB R2018b - academic use, and am trying to run the following script saved in a file called problem0611.m. When I select "Run: problem0611", nothing prints to the command window, and nothing is saved to the workspace. I tried removing line 12 and just relying on the workspace, but even then nothing was saved to the workspace. How do I actually run this code? (I did do somet Googling to try to figure this out on my own, but didn't have any luck.)
function problem0611()
m=2;
n=3;
for i = 1:5
A = foo(m,n);
AAT = A*transpose(A);
ATA = transpose(A)*A;
rankAAT = rank(AAT);
detAAT = det(AAT);
rankATA = rank(ATA);
detATA = det(ATA);
A; AAT; rankAAT; detAAT; ATA; rankATA; detATA;
end
fprintf('\n');
end
function [myMatrix] = foo(m,n)
myMatrix = randi(7,m,n)-4*ones(m,n);
end
Réponse acceptée
Plus de réponses (1)
Nastassja Riemermann
le 25 Mar 2019
Catégories
En savoir plus sur Desktop dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!