Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Matrix and fprintf command

Asked by Gimmy Morales

Gimmy Morales (view profile)

on 19 Sep 2013

Well, I have a 5x8 matrix; in the last part of my assignment I have to show A(5,2) and A(3,8) by using fprintf... How can I do that? (Sorry for my english)

1 Comment

Gimmy Morales

Gimmy Morales (view profile)

on 19 Sep 2013

to be more specific this is the Matrix (sorry, is a 6x8)

A= [2 5 6 8 5 6 2 5; 1 5 6 6 8 9 5 8; 8 5 6 4 2 9 5 -0.128; 2 5 7 1 5 2 8 4; 5 3/4 4 5 8 8 1 1; 0 5 1 2 1 1 0 9]

so it means A(5,2)= 3/4 A(3,8)= -0.128

But don't know how to show it wt fprinf

Gimmy Morales

Gimmy Morales (view profile)

Tags

Products

1 Answer

Answer by Walter Roberson

Walter Roberson (view profile)

on 19 Sep 2013

fprintf('%g %g\n', A(5,2), A(3,8))

1 Comment

Jan Simon

Jan Simon (view profile)

on 19 Sep 2013

@Gimmy: Please read the Getting Started chapters of the documentation to learn such basics.

Walter Roberson

Walter Roberson (view profile)

Contact us