Trouble with getting table=() to work
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
ray brunkow
el 13 de Sept. de 2015
Respondida: ray brunkow
el 13 de Sept. de 2015
Hello, I just started playing around with some basic text formatting with Matlab. In one set of code I had zero problems getting the table function to work as expected, yet now using the same basic format it is providing a worthless error:
Error: File: my.m Line: 97 Column: 44 The expression to the left of the equals sign is not a valid target for an assignment.
the following lines provide nice clean column matrices as is required for my table output. they are all 6x1:
Element = {'Theta';'R';'Xm';'Z';'Req';'Xeq'}
Open_Circuit = {thetaSC;Rc;Xm;'NA';'NA';'NA'}
Short_Circuit = {'NA';'NA';'NA';Zsc;XZsc;YZsc}
Low_Voltage = {'NA';RCsec;XMsec;'NA';Req_sec;Xeq_sec}
When I run them without the ; they produce the following:
Element =
'Theta'
'R'
'Xm'
'Z'
'Req'
'Xeq'
Open_Circuit =
[ 1.3134]
[1.7633e+03]
[ 534.0370]
'NA'
'NA'
'NA'
Short_Circuit =
'NA'
'NA'
'NA'
[0.5589 + 2.1231i]
[ 0.5589]
[ 2.1231]
Low_Voltage =
'NA'
[440.8333]
[133.5093]
'NA'
[ 0.1397]
[ 0.5308]
This is correct behavior for those lines of code, yet when I add the following everything blows up:
Equivalen_Circuit_through_Low-voltage_Side = table(Open_Circuit,Short_Circuit,Low_Voltage,'RowNames',Element)
Matlab provides a worthless error message from above. I see no difference between this broken code and the following fully functional code:
Element = {'R primary';'X primary';'Rc';'Xm';'R secondary';'X secondary'};
per = {'pu';'pu';'pu';'pu';'pu';'pu'};
Value = {Rp_pu;Xp_pu;Rc_pu;Xm_pu;Rs_pu;Xs_pu};
Per_Unit_Values = table(per,Value,'RowNames',Element);
This produces a nice clean table as expected:
Per_Unit_Values =
per Value
____ _________
R primary 'pu' [ 0.0100]
X primary 'pu' [ 0.0141]
Rc 'pu' [78.1250]
Xm 'pu' [ 9.3750]
R secondary 'pu' [ 0.0043]
X secondary 'pu' [ 0.0052]
So I am here asking for some assistance. The table is not required, but its so much nicer then single line responses or worse just allowing the variable to display its answer two lines lower on the screen. Very sloppy output I'd like to avoid.
Thanks in advance.
0 comentarios
Respuesta aceptada
Walter Roberson
el 13 de Sept. de 2015
Equivalen_Circuit_through_Low-voltage_Side = table(Open_Circuit,Short_Circuit,Low_Voltage,'RowNames',Element) '
has a subtraction on the left side of the "=". Perhaps you wanted Low_voltage instead of Low-voltage
1 comentario
Stephen23
el 13 de Sept. de 2015
Perhaps the documentation might be useful: "A valid variable name starts with a letter, followed by letters, digits, or underscores".
Más respuestas (1)
Ver también
Categorías
Más información sobre Characters and Strings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!