Thank you, the last update seems to work, there are no more exceptions when the code runs but I am unable to access the p, s, and mu in C++. p is supposed to be a 1X13 array of double, s is a 1X1 struct with fields R (13X13) double, df is integer, normr is a double, mu is 2X1 array of double.
FutureResult<std::vector<Array>> result = matlabPtr->fevalAsync(u"polyfit", 3, { mxArrayX, mxArrayY, factory.createScalar<double>(poly_size) }); // line 64
.
.
.
// Extract s and mu if needed
auto s_field1 = s[0][u"normr"]; // line 81
double mu_field1 = mu[0][u"field1"]; // line 82
std::cout >> poly_coefficients[0]; // line 83
These are the errors in Visual Studio
Rebuild started at 12:59 PM...
1>------ Rebuild All started: Project: ectCalFit, Configuration: Debug x64 ------
1>matlab_functions.cpp
1>D:\OneDrive - azureford\Documents\Visual Studio 2022\Projects\ectCalFit\ectCalFit\matlab_functions.cpp(64,135): warning C4244: 'argument': conversion from 'size_t' to 'const T', possible loss of data
1>D:\OneDrive - azureford\Documents\Visual Studio 2022\Projects\ectCalFit\ectCalFit\matlab_functions.cpp(64,135): warning C4244: with
1>D:\OneDrive - azureford\Documents\Visual Studio 2022\Projects\ectCalFit\ectCalFit\matlab_functions.cpp(64,135): warning C4244: [
1>D:\OneDrive - azureford\Documents\Visual Studio 2022\Projects\ectCalFit\ectCalFit\matlab_functions.cpp(64,135): warning C4244: T=double
1>D:\OneDrive - azureford\Documents\Visual Studio 2022\Projects\ectCalFit\ectCalFit\matlab_functions.cpp(64,135): warning C4244: ]
1>D:\OneDrive - azureford\Documents\Visual Studio 2022\Projects\ectCalFit\ectCalFit\matlab_functions.cpp(81,24): error C2679: binary '[': no operator found which takes a right-hand operand of type 'const char16_t [6]' (or there is no acceptable conversion)
1>C:\Program Files\MATLAB\R2020b\extern\include\MatlabDataArray\ArrayElementTypedRef.hpp(108,55):
1>could be 'matlab::data::ArrayElementTypedRef<T,false> matlab::data::ArrayElementTypedRef<matlab::data::Struct,false>::operator [](std::string)'
1> with
1> [
1> T=matlab::data::Array
1> ]
1>C:\Program Files\MATLAB\R2020b\extern\include\MatlabDataArray\ArrayElementTypedRef.hpp(86,51):
1>or 'matlab::data::ArrayElementTypedRef<matlab::data::Struct,false> matlab::data::ArrayElementTypedRef<matlab::data::Struct,false>::operator [](size_t)'
1>D:\OneDrive - azureford\Documents\Visual Studio 2022\Projects\ectCalFit\ectCalFit\matlab_functions.cpp(81,24):
1>while trying to match the argument list '(matlab::data::ArrayElementTypedRef<matlab::data::Struct,false>, const char16_t [6])'
1>D:\OneDrive - azureford\Documents\Visual Studio 2022\Projects\ectCalFit\ectCalFit\matlab_functions.cpp(82,28): error C2679: binary '[': no operator found which takes a right-hand operand of type 'const char16_t [7]' (or there is no acceptable conversion)
1>C:\Program Files\MATLAB\R2020b\extern\include\MatlabDataArray\ArrayElementTypedRef.hpp(108,55):
1>could be 'matlab::data::ArrayElementTypedRef<T,false> matlab::data::ArrayElementTypedRef<double,false>::operator [](std::string)'
1> with
1> [
1> T=matlab::data::Array
1> ]
1>C:\Program Files\MATLAB\R2020b\extern\include\MatlabDataArray\ArrayElementTypedRef.hpp(86,51):
1>or 'matlab::data::ArrayElementTypedRef<T,false> matlab::data::ArrayElementTypedRef<T,false>::operator [](size_t)'
1> with
1> [
1> T=double
1> ]
1>D:\OneDrive - azureford\Documents\Visual Studio 2022\Projects\ectCalFit\ectCalFit\matlab_functions.cpp(82,28):
1>while trying to match the argument list '(matlab::data::ArrayElementTypedRef<T,false>, const char16_t [7])'
1> with
1> [
1> T=double
1> ]
1>D:\OneDrive - azureford\Documents\Visual Studio 2022\Projects\ectCalFit\ectCalFit\matlab_functions.cpp(83,15): error C2676: binary '>>': 'std::ostream' does not define this operator or a conversion to a type acceptable to the predefined operator
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include\xstring(5144,32):
1>could be 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &)'
1> D:\OneDrive - azureford\Documents\Visual Studio 2022\Projects\ectCalFit\ectCalFit\matlab_functions.cpp(83,10):
1> 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &)': could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ostream'
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include\istream(842,32):
1>or 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,_Elem *)'
1> D:\OneDrive - azureford\Documents\Visual Studio 2022\Projects\ectCalFit\ectCalFit\matlab_functions.cpp(83,10):
1> 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,_Elem *)': could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ostream'
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include\istream(847,31):
1>or 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,signed char *)'
1> D:\OneDrive - azureford\Documents\Visual Studio 2022\Projects\ectCalFit\ectCalFit\matlab_functions.cpp(83,10):
1> 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,signed char *)': could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ostream'
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include\istream(852,31):
1>or 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,unsigned char *)'
1> D:\OneDrive - azureford\Documents\Visual Studio 2022\Projects\ectCalFit\ectCalFit\matlab_functions.cpp(83,10):
1> 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,unsigned char *)': could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ostream'
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include\istream(858,32):
1>or 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,_Elem &)'
1> D:\OneDrive - azureford\Documents\Visual Studio 2022\Projects\ectCalFit\ectCalFit\matlab_functions.cpp(83,10):
1> 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,_Elem &)': could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ostream'
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include\istream(881,31):
1>or 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,signed char &)'
1> D:\OneDrive - azureford\Documents\Visual Studio 2022\Projects\ectCalFit\ectCalFit\matlab_functions.cpp(83,10):
1> 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,signed char &)': could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ostream'
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include\istream(887,31):
1>or 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,unsigned char &)'
1> D:\OneDrive - azureford\Documents\Visual Studio 2022\Projects\ectCalFit\ectCalFit\matlab_functions.cpp(83,10):
1> 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,unsigned char &)': could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ostream'
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include\istream(900,9):
1>or '_Istr &&std::operator >>(_Istr &&,_Ty &&)'
1> D:\OneDrive - azureford\Documents\Visual Studio 2022\Projects\ectCalFit\ectCalFit\matlab_functions.cpp(83,10):
1> '_Istr &&std::operator >>(_Istr &&,_Ty &&)': could not deduce template argument for '__formal'
1> C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include\istream(899,102):
1> '<template-parameter>': you cannot create a pointer to a reference
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include\complex(2235,28):
1>or 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,std::complex<_Other> &)'
1> D:\OneDrive - azureford\Documents\Visual Studio 2022\Projects\ectCalFit\ectCalFit\matlab_functions.cpp(83,10):
1> 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,std::complex<_Other> &)': could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ostream'
1>PolyFit.cpp
1>Generating Code...
1>Done building project "ectCalFit.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
========== Rebuild completed at 12:59 PM and took 04.647 seconds ==========