How do I present my solutions?

조회 수: 1 (최근 30일)
Aidan Shek
Aidan Shek 2017년 2월 22일
댓글: Jan 2017년 2월 22일
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
Jan
Jan 2017년 2월 22일
@John: This is a good answer and cannot be accepted, when it is posted as comment.
John Chilleri
John Chilleri 2017년 2월 22일
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 :]

댓글을 달려면 로그인하십시오.

답변 (1개)

John Chilleri
John Chilleri 2017년 2월 22일
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
Jan
Jan 2017년 2월 22일
@John: Sometimes a simple approach is simply optimal. +1

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Genomics and Next Generation Sequencing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by