Error: File: Symbolic_Relationships.m Line: 17 Column: 11 The expression to the left of the equals sign is not a valid target for an assignment.

1 次查看(过去 30 天)
1 %Symbolic relatioships
2 %Justin Sheldon
3 %MATLAB Assignment #1 EGR 271
4
5 clear;
6 clc;
7
8 fprintf('Enter 1 to find i(t) given q(t)\n')
9 fprintf('Enter 2 to find q(t) given i(t) over a range \n')
10 fprintf('Enter 3 to find p(t) given w(t)\n')
11 fprintf('Enter 4 to find w(t) given p(t)\n')
12 Choice=input('');
13
14 if(Choice==1)
15 [
16 fprintf('i(t)=dq/dt\n')
17 coeff=input('Please enter the coeffecent before the e: ');
18 exp=input('Please enter the exponent ignoring the t variable: ');
19 coeff1=coeff*exp;
20 fprintf('i(t) = %0fe',r1)
21 fprintf('^ %0t',exp)
22
23 ]
24
25 elseif(Choice==2)
[
]
elseif(Choice==3)
[
]
elseif(Choice==4)
[
]
end

采纳的回答

Prasanth Sikakollu
The error is due to the square brackets that you used to denote a block for if condition. Square brackets are not required to denote a block in MATLAB.
if(Choice==1)
fprintf('i(t)=dq/dt\n')
coeff = input('Please enter the coeffecent before the e: ');
exp = input('Please enter the exponent ignoring the t variable: ');
coeff1 = coeff * exp;
fprintf('i(t) = %0fe',r1)
fprintf('^ %0t',exp)
elseif(Choice==2)
% Your code goes here
elseif(Choice==3)
% Your code goes here
elseif(Choice==4)
% Your code goes here
end
This code would probably help.

更多回答(0 个)

产品


版本

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by