Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

print matrix of month

1 Ansicht (letzte 30 Tage)
Lee
Lee am 20 Nov. 2013
Geschlossen: Walter Roberson am 20 Nov. 2013
hello im supposed to create a function that gets input of a month and year and im supposed to get output prinnted my problem is that every time the function gets to dates like 10 or 20 it only prints 1 2 so instead of 11 12 13 14...i get 1 12 13 14... i tried doing if w(i,j)='10' fprintf('10') but it says it is not possible to compare strings im not aloowed to usestrcmp
function fprintfmatrix(mat)
w=num2str(mat);
rows=size(w,1);
col=size(w,2);
for i=1:rows;
for j=1:col;
if w(i,j)~='0'
fprintf(w(i,j))
elseif w(i,j)=='0';
fprintf(' ')
end
end
fprintf('\n')
end
end
  2 Kommentare
Azzi Abdelmalek
Azzi Abdelmalek am 20 Nov. 2013
Bearbeitet: Azzi Abdelmalek am 20 Nov. 2013
Give a sample of your data

Antworten (0)

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by