No output in the standalone executable matlab

1 次查看(过去 30 天)
hello there,
I'm having a weird problem, I have written a code to calculate the volume by integration and made a gui to display the result
when I run the code and input the functions the when I press "calculate volume" as in the attached image the output appear with no problem
but when I use Matlab compiler to make a standalone app the pushbutton never work!!!
please I need an urgent help
note; every other pushbutton are working perfectly except "calculate volume"
here is the code
% --- Executes on button press in calc_vx.
function calc_vx_Callback(hObject, eventdata, handles)
% hObject handle to_x calc_vx (see GCBO)
% eventdata reserved - to_x be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
syms x
func_out =sym(get(handles.input_funcOutx, 'string'));
func_in =sym(get(handles.input_funcInx, 'string'));
axis_rotation = sym(get(handles.input_axisx, 'string'));
func_out1 = pi*(func_out - axis_rotation).^2;
func_in1 = pi*(func_in - axis_rotation).^2;
H=int((func_out1 - func_in1),x,str2double(get(handles.from_x, 'string')), str2double(get(handles.to_x, 'string')));
if (H) < 0
ed = errordlg('Reverse outer and inner functions since volume is negative','Error');
set(ed, 'WindowStyle', 'modal');
uiwait(ed);
else
set(handles.out_cal_vx, 'string', num2str(char(H)));
end
is there a problem with the compiler??

采纳的回答

Walter Roberson
Walter Roberson 2019-6-9
It is never possible to compile anything from the Symbolic Toolbox.
  5 个评论
Walter Roberson
Walter Roberson 2019-6-9
No, there is no version of MATLAB in which you can do what you want to do without writing a lot of code.
The process of analyzing character strings to find the components and their proper relationship is known as "parsing" . For example, how should
1+2 * 3
be handled? MATLAB knows about standard operations such as + and * and it knows that * has higher priority than +, so it knows that 1+2 * 3 should be treated as 1 + (2 * 3) . Those of us of sufficient... lived experience.... might remember that there used to be calculators that would take an input of 1 + 2 * 3 as meaning the same as (1 + 2) * 3 .
Now consider for a moment
1 + 2 - 3
and compare that to the nearly identical character vector
1 +2 -3
do they mean the same thing? To some computer languages they do mean the same thing. To MATLAB, they mean very different things.
So parsing is the phase of figuring out how the parts of the character input fit together, which operations are implied by them in which order.
But parsing by itself is not the same as execution: parsing is analysis. Parsing might rewrite into a fully decomposed set of calls, such as converting
x.^5 + sin(pi*x/5)
into
plus( power(x, 5), sin( rdivide( times( pi(), x), 5) ) )
or it might convert into some kind of internal data structure, possibly one that might be represented as
push x
push 5
power()
pi()
push x
times()
push 5
rdivide()
sin()
plus()
This code might all be in a function where x is not known, so it might not be appropriate to execute it to completion at the time of parsing: parsing just has to analyze and leave data suitable for a later phase to efficiently execute.
At some later point you execute with a particular numeric x, in the execution phase.
Between the parsing and the execution phase, there might have been code generation into machine code appropriate for the computer being used. That kind of code generation into machine code is called "compiling". When compiling can be done, the resulting code has the potential to be quite efficient.
But there is no rule that you must generate machine code: it is perfectly valid to have code that analyzes text (parses) and when appropriate it uses the data structures output by parsing in order to execute "on the fly", without compiling. A program that takes in characters representing work to be done and executes the request interactively is known as an "interpreter"

请先登录,再进行评论。

更多回答(1 个)

Steven Lord
Steven Lord 2019-6-9
编辑:Steven Lord 2019-6-9
Symbolic Math Toolbox is an ineligible product for MATLAB Compiler. As stated on that page, "this means that an application or component you deploy cannot use functionality from these products." The sym, syms, and int functions are part of Symbolic Math Toolbox and so will not work in a deployed application.
Depending on the specific expression you're trying to integrate, performing the integration before deploying your application and hard-coding the result in your code may be an option. Another potential option is to integrate numerically using the integral function, though if you do that you may need to be careful in creating the anonymous function you're going to pass into the integral function.
  1 个评论
Anas Mustafa
Anas Mustafa 2019-6-9
thank you. Can you please explain to me how to do the integration befor deploying the app since I'm still a beginner and I don't understand what you mean by that. i.e were do I write this code to make it work wvwn if the volume calculated automatically without pressing the pushbutton that's ok
appreciate your help @stevenlord

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Assumptions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by