I'm trying to display a 2D table
Mostra commenti meno recenti
Hi,
i'm trying to display a 2d table for a school projet, and i'm having trouble making it work, the code seem fine to me but I can't see to find how do I call the specific case I want to display.
my code is :
for ii=1:taille
if(ii==1)
fprintf('\t%g\t\t\t\t',tableau(ii));
elseif(ii==2)
fprintf('%g\t\t\t\t',tableau(ii));
elseif(ii==3)
fprintf('%g\t\t\t\t',tableau(ii));
elseif(ii==4)
fprintf('%g\t\t\t\t\t\t\n',tableau(ii));
end
end
fprintf('\n');
fprintf('\n');
%affichage de la deuxième ligne du tableau 2D
for jj=1:taille
if(jj==1)
fprintf('\t%g\t\t\t\t',tableau(jj));
elseif(jj==2)
fprintf('%g\t\t\t\t',tableau(jj));
elseif(jj==3)
fprintf('%g\t\t\t\t',tableau(jj));
elseif(jj==4)
fprintf('%g\t\t\t\t\t\t\n',tableau(jj));
end
end
and the table displays this when i call : afficher_ecran_de_jeu([1,2,3,4;5,6,7,8])
Carte 1 Carte 2 Carte 3 Carte 4
--------- --------- --------- ---------
1 5 2 6
1 5 2 6
when it supposed to display
1 2 3 4
5 6 7 8
thank you in advance. (PS: I started learning MATlab only 4 weeks ago).
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Title in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!