Fix the function hlp
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Ainars Cernavskis
il 26 Gen 2021
Commentato: Rena Berman
il 27 Nov 2023
i was told to write funciton for this: but it keeps saying something is wrong but i dont know what is wrong with it .
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1553697/image.png)
function [ arr ] =special_matrix( n )
if n>2
for i = 1:n
for j = 1:n
if mod(j,3)==0
arr(i,j)}=((i-1)*n+j}^j;
else
arr(i,j)={i-1}*n+j;
end
end
end
else
disp('Error; n must be greater than i')
end
end
3 Commenti
Sam Chak
il 23 Nov 2023
The original question may be beneficial for people who wish to learn how to create special square matrices.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1550842/image.png)
Risposta accettata
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!