Display Matrix when member of a class
    조회 수: 7 (최근 30일)
  
       이전 댓글 표시
    
Hi!
I have a class containing two propoerties : InitialData is just an array, whereas Final is a 2*2 matrix. How can I ask Matlab to display the values of both these variables? Rather than
    InitialData: [2.2  12  3.4]
      FinalData: [2x2 double]
Thanks!
댓글 수: 0
채택된 답변
  Image Analyst
      
      
 2013년 5월 27일
        Maybe
disp(yourClassVariable.InitialData);
disp(yourClassVariable.FinalData);
Or you can leave off the disp(); so that you just have the names alone.
Or you can use fprintf():
fprintf('InitialData = %.1f %.1f %.1f\n', yourClassVariable.InitialData)
fprintf('FinalData:\n', yourClassVariable.FinalData)
fprintf('    %.1f %.1f\n', yourClassVariable.FinalData)
댓글 수: 0
추가 답변 (1개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

