Parse error at EDD
Ältere Kommentare anzeigen

5 Kommentare
Rono Noah
am 17 Nov. 2020
Steven Lord
am 17 Nov. 2020
Without seeing the file this is going to be difficult if not impossible to answer. Please show us the section of heatConduction_Cline_2 around line 239, say lines 230 through 250 (or the end of the file, whichever comes first.) Also tell us if there are any Code Analyzer errors (red lines) or warnings (orange lines) in the Editor document window for that section of heatConduction_Cline_2. If there are, indicate which lines have those markers and what each marker says when you hover the mouse over the red and/or orange lines.
Steven Lord
am 18 Nov. 2020
Please post it here so everyone can see it and contribute to determining the cause of the error and how to correct it.
Rono Noah
am 18 Nov. 2020
Antworten (1)
Steven Lord
am 18 Nov. 2020
Let's look at one section of the snippet of code you posted.
for m = 1:L_Z
for n = 1:L_Pe
H = (Pe(n)*miu.^2).^2./(1+miu.^2)/2+Z(m)^2./miu.^2/2;
y_miu = exp(-H)./(1+miu.^2)/sqrt(2*pi^3);
% y_miu = exp(-(X(n)+Pe(1)*miu).^2./(1+miu.^2)/2)./(1+miu.^2)/sqrt(2*pi^3);
I_miu(m,n) = sum(y_miu)*d_miu;
plot(Pe',I_miu);
drawnow;
end
This end statement ends the for loop using the variable n.
end
This end statement ends the for loop using the variable m.
xlabel('Pe')
ylabel('f')
legend('Z/R = 0', 'Z/R = 0.2', 'Z/R = 0.5', 'Z/R = 1')
end
This end statement either ends something (another for loop, a while loop, a function statement) that began before the start of the snippet you posted or it isn't associated with another keyword. One way to tell which is which is to move the cursor over that end statement. If it is associated with something higher up in the code that should flash on the screen. If it doesn't it's likely a mismatched end.
I'd probably smart indent the code and make sure that each end is associate with the correct statement then remove the extra mismatched one. Which one you remove can make a difference. Consider the following:
function y = foo650718
y = 0;
for k = 1:5
for p = 1:7
y = y + 1;
end
y = y + 1;
end
y = y + 1;
end
end
There are three keywords that start a block to be ended by end: the function statement, the for over k, and the for over p. If you smart indent this (or look at the file in the Editor) there's one extra end statement. But which one you delete (or comment out) will affect the output of the function (except the last two; deleting either of those gives the same result.) Commenting out the first results in y = 75, the second in y = 45, and the third or fourth in y = 41. Smart indenting the code while different end statements are commented out will also show that the various "y = y + 1;" statements get included in different numbers of nested loops depending on which end is commented.
Kategorien
Mehr zu Performance and Memory finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!