Convert Matlab code to C++; When storing only the desired 4-dimensional value in a variable and sending it as an argument

54 views Asked by At

I am converting matlab code to C++.

When storing only the desired 4-dimensional value in a variable and sending it as an argument

If you look at the size of a specific variable loaded from a .m file in the MATLAB console, it is as follows.

size(someVar)

ans = 44100 14 72 2

And with a specific function, the data of the dimension starting from 1 is taken out and inserted as shown below.

someVar(1:2048, 5, 25, 2)

In this way, I am directly entering it as the second argument.

some_func(A, someVar(1:2048, 5, 25, 2));

How do I implement loading the values of the four dimensions below in C++?

someVar(1:2048, 5, 25, 2)

The values 5, 25, and 2 in the 2nd, 3rd, and 4th dimensions cannot be seen in Matlab.

a1 = someVar(1:2048, 5, 25, 2)

If I print a1 like below, I only see 2048 first dimension data. What happened?

size(a1)

ans = 2048 1

I translated matlab to C++

[matlab]

function c = some_func(a, b)

[c++]

extern void some_func(const coder::array<double, 1U> &a, const double b_data[], const int b_size[1], coder::array<double, 1U> &c);

Why 1more argument in C++? referencely c is retrun value

0

There are 0 answers