I clicked fix on a MATLAB suggetion about the equal sign now the script is not showing the vectors.

조회 수: 8 (최근 30일)
%Problem 1
fprintf ('\n******** Problem 1 **********')
%Problem 1 will go here
%A1 Type in each element using commas/spaces to separate them
A1 = [3,6,9,12,15];
%A2 Use the [first value : spacing : last value] notation
A2 = (3:3:15);
%A3 Use the linspace command
A3 = linspace (3,15,5);
  댓글 수: 2
Raúl GB
Raúl GB 2016년 10월 26일
Sorry, but what do you mean by showing the vectors? Do you want them printed on the screen?
Merveille Kavota
Merveille Kavota 2016년 10월 26일
I mean the vector do not show up ********************************************** Name: Merveille Kavota Date: 10/31/2016 Seat/Table: N File: Class17.m Instructor: Dr. Herak and Ms. Sarah Hulbert ********************************************** Class_17_application ****** Problem 1 ******** ****** Problem 2 ********>>

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

채택된 답변

Adam
Adam 2016년 10월 26일
I assume the thing you clicked 'Fix' on was an orange warning about having no ; at the end of a line. Without that your vector prints to the command line. Usually this is undesirable so Matlab gives this warning and its solution if you click 'Fix' is to add the ; to the end of the line so that it no longer prints the results to the command window.

추가 답변 (1개)

Raúl GB
Raúl GB 2016년 10월 26일
If you want to use the function fprintf to show the components of the vectors on the screen, you have to insert the command %d (for integers) %f (floating numbers). As it is shown here:
fprintf ('******** Problem 1 ******** %d \n', A1)

카테고리

Help CenterFile Exchange에서 Entering Commands에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by