How do I present my solutions?
Afficher commentaires plus anciens
If for example I got a matrix of : A = [1;2;3;4] how do i get it into the form so that in the matlab console it displays for example
x_answer = 1
y_answer = 2
z_answer = 3
p_answer = 4
3 commentaires
John Chilleri
le 22 Fév 2017
You could write a simple function,
function printToAidanSheksDesires(A)
fprintf('\nA = \n\n')
fprintf(' x_answer = %d\n',A(1))
fprintf(' y_answer = %d\n',A(2))
fprintf(' z_answer = %d\n',A(3))
fprintf(' p_answer = %d\n',A(4))
end
You can remove spacing and A = or adjust whatever else you'd like, hope this helps!
Jan
le 22 Fév 2017
@John: This is a good answer and cannot be accepted, when it is posted as comment.
John Chilleri
le 22 Fév 2017
I often find that when I post simple approaches, people follow up with clever approaches, so I tend to want to comment my simple approaches :]
Réponses (1)
John Chilleri
le 22 Fév 2017
Hello,
You could write a simple function,
function printToAidanSheksDesires(A)
fprintf('\nA = \n\n')
fprintf(' x_answer = %d\n',A(1))
fprintf(' y_answer = %d\n',A(2))
fprintf(' z_answer = %d\n',A(3))
fprintf(' p_answer = %d\n',A(4))
end
You can remove spacing and A = or adjust whatever else you'd like.
Hope this helps!
1 commentaire
Jan
le 22 Fév 2017
@John: Sometimes a simple approach is simply optimal. +1
Catégories
En savoir plus sur Genomics and Next Generation Sequencing 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!