Coder on Matlab to C++ , sym and perms function? - c++

I am discovering the coder tool in Matlab. some of my code was successfully converted but it fails in functions which contain the functions "sym" for symbolic and "perms" for permutations. Also I seem to get an error when I save the answer "ans" of for example "A==B". Any idea how to solve this problem?
Thank you for your help
Here is an example of parts of my matlab function that cannot be transformed into c++ with coder:
b=4;
s=2;
one=ones(factorial(b),1);
two=2*ones(factorial(b),1);
B=perms(s+1:b+s);
S=[one,two,B];
sz=size(S);
%%%%%%%%%%%%%%%%%%%
L=[1,3;1,4;1,5;1,6;2,3;2,4;2,5;2,6];
x=perms(1:8);
M=[];

Some toolbox functions cannot be compiled, i.e. they can only be run from a MATLAB session. The following post tells us that functionality in the Symbolic toolbox cannot be compiled.
http://se.mathworks.com/matlabcentral/answers/96441-why-am-i-unable-to-compile-functions-from-the-symbolic-math-toolbox
So most likely this is the reason why you are running into problems when you try to run it in compiled form.
More info about compiler support for various toolboxes can be found here:
http://se.mathworks.com/products/compiler/supported/compiler_support.html
Symbolic Math toolbox does not appear on the list and any toolbox that is not listed is not supported (i.e. cannot be compiled).

Related

Can we convert a matlab built in function to c/c++ code using matlab coder

Can we convert matlab built in function that are present in 5G toolbox to c/c++ code using matlab coder.
It is shown at the end of the help page of that specific function. Type
>> help yourFunctionName
at the command line. Then scroll to the very bottom and then look at Extended Capabilities > C/C++ Code Generation. When that is present, you should be able to generate code (please unfold to see the details).
If C/C++ Code Generation is not mentioned, you cannot generate code from that function.

How to enable documentation comments for C++/Qt in VS Code?

Following these instructions, I have already managed to fix the IntelliSense suggestions for my C++ hello world program using Qt headers. So for instance, when I type QString::, the class methods append, arg, etc. are suggested correctly. However, when I choose any of them, I would expect to read a short documentation comment describing what the selected method does do. Unfortunately, this information is not available.
I have also followed this tip and installed qt5-doc on my Ubuntu system, but I have no idea how I can use the .qch documentation files in VS Code. Do you have any pointer for me?

How can you obtain an AST for Microsoft C++ (MSVC)?

I want to be able to query what dependencies there are for C++ functions and variables in my source code. You could do that with Clang on the Linux side, but for Windows(.NET, etc) I can't seem to find a way to get access to the AST.
Background:
Say I fixed a part of my code. I'm trying to find a tool to easily identify all the areas in my source code affected by this fix. For example, if I changed Foo(), I'll check all areas that Foo() is used and all functions that Foo() calls, gather them, and print them out in a list. Preferably, it will also be able to gather multiple levels of dependencies. If it were to be represented visually, it'll look something like Sourcetrail. Unfortunately, I want to be able to do this programmatically instead of via a UI, so that link isn't what I'm looking for. I looked at DMS Search Engine but I can't seem to make its trial version to download. So I was wondering if I can just do it myself. But I can't seem to figure out how Sourcetrail, for example, was able to get the AST from a Visual Studio C++ project.

How to call (or compile) C++ code from Matlab 2016

I'm new with Matlab-C combination and I'm very lost. Any help will be very thankful.
Essentially, what I want is to use a C++ code from a simple matlab script. I've created some variables' values in matlab in order to give them as inputs to the C++ code and then capture theirs output of that C++ code and loading them into matlab.
I have a main.cpp and a makefile into the same folder. (they work well)
I've created a simple test.m file to create the variables' values for the C++ code and then, recover their outputs.
What I've done is to run the makefile using the mac terminal by typing
make
in order to create an executable called "benchmark". Each time I need to change a tiny variable's value from my matlab script, I must go to the terminal again, type
./benchmark
and then goes again to the matlab and run the test.m file to update the inputs of the C++ code. As you see, this is not the optimal way to work it.
So I'm wondering how to pass values created in matlab and in the same script updating the ./benchmark executable.
Thanks in advance guys.

What exactly is JS2C?

I have recently started implementing v8 into my game engine, and I have chosen Node over bare-bone v8 and I have decided to build my game engine as a native node module. I have had many performance issues so far and I have paused development for further research.
I have came across Pixel Dust Game engine and one of the things I have noticed in its v8/Node bindings is these gigantic const char arrays that obviously are not generated by humans! and in its title I found /* this file automatically generated by js2c.py */.
I understand JS2C is a part of v8 and I have noticed these arrays in Node's source code as well. What are these? And how they may help me in Node module development?
Could you please also provide an example of its usage?
From the v8 source you linked:
# This is a utility for converting JavaScript source code into C-style
# char arrays. It is used for embedded JavaScript code in the V8
# library.
I can't give any usage examples as I have never used it before.
JS2C, found in [node source]/tools/js2c.py and [v8 source]/tools/js2c.py, as I understand it, takes JavaScript and turns it into a compileable C++ array.
Format: js2c.py [c++ output file] [JS input file]
I actually have an issue on GitHub to try and figure out how to use it: https://github.com/nodejs/help/issues/1301
You might find some info from collaborators of that issue.