Category: News
Discrepancy in EPSG:3003 Coordinate Conversion Results in MATLAB
Hi everyone,
I need to convert latitude and longitude coordinates to the EPSG:3003 coordinate system. I have written the following lines of code:
proj3003 = projcrs(3003);
posLLH = [43.7918028 11.2474672 0];
[posEPSG3003(1), posEPSG3003(2)] = projfwd(proj3003, posLLH(1), posLLH(2));
I get the following result:
posEPSG3003 = [1680827.953610798, 4851292.727994160]
However, when I use an online tool like the one at EPSG.io, I get:
posEPSG3003 = [1680850, 4851220]
Can anyone explain the reason for this discrepancy?
Thank you in advance for your help!Hi everyone,
I need to convert latitude and longitude coordinates to the EPSG:3003 coordinate system. I have written the following lines of code:
proj3003 = projcrs(3003);
posLLH = [43.7918028 11.2474672 0];
[posEPSG3003(1), posEPSG3003(2)] = projfwd(proj3003, posLLH(1), posLLH(2));
I get the following result:
posEPSG3003 = [1680827.953610798, 4851292.727994160]
However, when I use an online tool like the one at EPSG.io, I get:
posEPSG3003 = [1680850, 4851220]
Can anyone explain the reason for this discrepancy?
Thank you in advance for your help! Hi everyone,
I need to convert latitude and longitude coordinates to the EPSG:3003 coordinate system. I have written the following lines of code:
proj3003 = projcrs(3003);
posLLH = [43.7918028 11.2474672 0];
[posEPSG3003(1), posEPSG3003(2)] = projfwd(proj3003, posLLH(1), posLLH(2));
I get the following result:
posEPSG3003 = [1680827.953610798, 4851292.727994160]
However, when I use an online tool like the one at EPSG.io, I get:
posEPSG3003 = [1680850, 4851220]
Can anyone explain the reason for this discrepancy?
Thank you in advance for your help! projfwd, projcrs, tiff, geotiff, matlab, llh, latitude, longitude, conversion, coordinates MATLAB Answers — New Questions
Error when trying to plot 3D Joint PDF
I’m suppose to plot the 3D Joint PDF of these two functions and compare it to the 3D Joint PDF of gaussian normal distribution, so I mulitplied them together but when I try to plot them I’m getting the (Z must be a matrix, not a scalar or vector error).
Question:
Code:
>> mu = 0;sigma = 1; %mean = 0, variance = 1
>> L = 100000; %length of random vector
>> x1 = rand(L,1); %x1 uniformly distributed U(0,1)
>> x2 = rand(L,1); %x2 uniformly distributed U(0,1)
>> w1 = sqrt(-2*log(x1)).*cos(2*pi*x2); %w1 pdf declared
>> w2 = sqrt(-2*log(x1)).*sin(2*pi*x2); %w2 pdf declared
>> w = w1.*w2; %joint pdf declared
>> X = -10:0.1:10;
>> Y = X;
>> gaussNormal = pdf(‘Normal’,X,mu,sigma); %declare gaussian normal pdf
>> [x,y] = meshgrid[X,Y];
>> mesh(x,y,w);
Error using mesh (line 71)
Z must be a matrix, not a scalar or vector.I’m suppose to plot the 3D Joint PDF of these two functions and compare it to the 3D Joint PDF of gaussian normal distribution, so I mulitplied them together but when I try to plot them I’m getting the (Z must be a matrix, not a scalar or vector error).
Question:
Code:
>> mu = 0;sigma = 1; %mean = 0, variance = 1
>> L = 100000; %length of random vector
>> x1 = rand(L,1); %x1 uniformly distributed U(0,1)
>> x2 = rand(L,1); %x2 uniformly distributed U(0,1)
>> w1 = sqrt(-2*log(x1)).*cos(2*pi*x2); %w1 pdf declared
>> w2 = sqrt(-2*log(x1)).*sin(2*pi*x2); %w2 pdf declared
>> w = w1.*w2; %joint pdf declared
>> X = -10:0.1:10;
>> Y = X;
>> gaussNormal = pdf(‘Normal’,X,mu,sigma); %declare gaussian normal pdf
>> [x,y] = meshgrid[X,Y];
>> mesh(x,y,w);
Error using mesh (line 71)
Z must be a matrix, not a scalar or vector. I’m suppose to plot the 3D Joint PDF of these two functions and compare it to the 3D Joint PDF of gaussian normal distribution, so I mulitplied them together but when I try to plot them I’m getting the (Z must be a matrix, not a scalar or vector error).
Question:
Code:
>> mu = 0;sigma = 1; %mean = 0, variance = 1
>> L = 100000; %length of random vector
>> x1 = rand(L,1); %x1 uniformly distributed U(0,1)
>> x2 = rand(L,1); %x2 uniformly distributed U(0,1)
>> w1 = sqrt(-2*log(x1)).*cos(2*pi*x2); %w1 pdf declared
>> w2 = sqrt(-2*log(x1)).*sin(2*pi*x2); %w2 pdf declared
>> w = w1.*w2; %joint pdf declared
>> X = -10:0.1:10;
>> Y = X;
>> gaussNormal = pdf(‘Normal’,X,mu,sigma); %declare gaussian normal pdf
>> [x,y] = meshgrid[X,Y];
>> mesh(x,y,w);
Error using mesh (line 71)
Z must be a matrix, not a scalar or vector. mesh error pdf joint gaussian normal uniform distribution MATLAB Answers — New Questions
how can i hidder(or enable=’off’) tab2?
Post Content Post Content how can i hidder(or enable=’off’) then tab2? MATLAB Answers — New Questions
Interaction MATLAB-C++ and toolboxes
Hi there,
Sorry if this is a newbie question but I’d like to get my ideas straight before start doing what I want to.
I understand there’s a way to use MATLAB code in C++ (i.e. calling it from C++). But my questions are:
– I have a bunch of functions all of which called by a script, is possible to call such script and retrieve the output. I can also wrap the script around another functions, but still, can I call a function that call another function (and so forth) even if those are in different files?
– I am in extreme needs of the image toolbox in my functions. Is this possible in the moment I call the code from C++?
– In which format I can obtain the output. Can I just map a MATLAB matrix in a C++ matrix?
– Can I pass the code an Image from C++ as a unsigned char matrix?
I understand there may be a documentation out there about this, but I found very fragmented sources, can you in case link me to a good one?
Thank you very muchHi there,
Sorry if this is a newbie question but I’d like to get my ideas straight before start doing what I want to.
I understand there’s a way to use MATLAB code in C++ (i.e. calling it from C++). But my questions are:
– I have a bunch of functions all of which called by a script, is possible to call such script and retrieve the output. I can also wrap the script around another functions, but still, can I call a function that call another function (and so forth) even if those are in different files?
– I am in extreme needs of the image toolbox in my functions. Is this possible in the moment I call the code from C++?
– In which format I can obtain the output. Can I just map a MATLAB matrix in a C++ matrix?
– Can I pass the code an Image from C++ as a unsigned char matrix?
I understand there may be a documentation out there about this, but I found very fragmented sources, can you in case link me to a good one?
Thank you very much Hi there,
Sorry if this is a newbie question but I’d like to get my ideas straight before start doing what I want to.
I understand there’s a way to use MATLAB code in C++ (i.e. calling it from C++). But my questions are:
– I have a bunch of functions all of which called by a script, is possible to call such script and retrieve the output. I can also wrap the script around another functions, but still, can I call a function that call another function (and so forth) even if those are in different files?
– I am in extreme needs of the image toolbox in my functions. Is this possible in the moment I call the code from C++?
– In which format I can obtain the output. Can I just map a MATLAB matrix in a C++ matrix?
– Can I pass the code an Image from C++ as a unsigned char matrix?
I understand there may be a documentation out there about this, but I found very fragmented sources, can you in case link me to a good one?
Thank you very much c++ MATLAB Answers — New Questions
Update #8 Available for Automating Microsoft 365 with PowerShell
The Most Comprehensive PowerShell Book for Microsoft 365
The Office 365 for IT Pros team is delighted to announce the availability of monthly update #8 for the Automating Microsoft 365 with PowerShell eBook. The book is included with the Office 365 for IT Pros eBook and is also available separately, including in a paperback edition published on a print on demand basis by Amazon.
Updates for the Automating Microsoft 365 with PowerShell eBook are published monthly, just like the Office 365 for IT Pros eBook. However, we try to make the PowerShell update available a few days ahead of the main book because it allows us to clear the deck to work on chapter updates for the main book at the end of each month.
The Office 365 for IT Pros eBook contains many PowerShell examples. Originally, it also included a PowerShell chapter. Because the book is already quite large and we wanted to give more coverage to the important topic of the Microsoft Graph and how it can be used to process Microsoft 365, the decision was made to create the Automating Microsoft 365 with PowerShell eBook and to update its content on an ongoing basis, just like we do with Office 365 for IT Pros. The net result is that the book now spans five chapters and 280 pages of practical and useful information about how to use PowerShell with Microsoft 365.
Mastering the Graph
In particular, we’ve spent a lot of time working out how to exploit the Microsoft Graph PowerShell SDK. This is an incredibly important component that not only replaces the AzureAD and Microsoft Online Services modules (due for imminent retirement) but also opens up the possibilities of accessing data such as Exchange Online mailboxes, SharePoint Online sites, pages, and lists, Planner plans and tasks, and so on. The book also covers how to access Microsoft 365 data with Azure Automation.
The nice thing about mastering the maze of Microsoft Graph APIs, permissions, and SDK cmdlets is that once you understand how things work, the same techniques can be applied to all sorts of data.
If you’re still struggling to convert scripts from using the AzureAD and MSOL modules, you’ll find a lot of value in Automating Microsoft 365 with PowerShell. We can’t convert scripts for you, but we can give you the knowledge needed to smoothen and quicken the process.
The Print Edition
Due to the 1,200-page (plus) size of the Office 365 for IT Pros eBook, we’ve never been able to provide a print edition. Printing a book that’s updated monthly sounds like a bit of fool’s errand, but we have received many requests because some people like consulting print books for technical topics. Some even went so far as to print the PDF issued for each monthly update.
There are many print on demand services available for books. We decided to try Amazon, and people can now buy a paperback edition of Automating Microsoft 365 with PowerShell. It’s impossible to update a print copy, so if you buy a printed book, it contains whatever content is current at the time of purchase. Two major differences exist between the print and electronic versions (PDF and EPUB). The print version obviously can’t support hyperlinks, so these become footnotes. The second difference is that we provide an index for the print version to replace the search capabilities that the electronic versions have.
The paperback has proven to be more popular than anticipated, so we’ll keep it going for those who want this option.
On to Update #9
In line with our regular cadence, monthly update #116 for the Office 365 for IT Pros eBook will be available for download on February 1, 2025. Subscribers can download the update #8 files for Automating Microsoft 365 with PowerShell now. We hope that you find the books useful. Let us know if we should cover other topics by adding a comment for this article.
MATLAB icon not showing in Ubuntu while running!!
I have installed MATLAB 2022b on Ubuntu 24.04.01. I could install MATLAB, and the launcher using sudo apt-get install matlab-support, Shortcut works fine and shortcut has MATLAB icon. The MATLAB also works fine and fast.
However, I cannot see MATLAB icon on the dock (taskbar), while it is runnig, instead I can see a gear icon (like settings icon). This is very confusing while running multiple applications, there is also a chance of wrongly closing the application.
Thanks in advance.I have installed MATLAB 2022b on Ubuntu 24.04.01. I could install MATLAB, and the launcher using sudo apt-get install matlab-support, Shortcut works fine and shortcut has MATLAB icon. The MATLAB also works fine and fast.
However, I cannot see MATLAB icon on the dock (taskbar), while it is runnig, instead I can see a gear icon (like settings icon). This is very confusing while running multiple applications, there is also a chance of wrongly closing the application.
Thanks in advance. I have installed MATLAB 2022b on Ubuntu 24.04.01. I could install MATLAB, and the launcher using sudo apt-get install matlab-support, Shortcut works fine and shortcut has MATLAB icon. The MATLAB also works fine and fast.
However, I cannot see MATLAB icon on the dock (taskbar), while it is runnig, instead I can see a gear icon (like settings icon). This is very confusing while running multiple applications, there is also a chance of wrongly closing the application.
Thanks in advance. icon not showing, matlab icon missing, confusing like settings icon MATLAB Answers — New Questions
The problem about Simscape Battery MBC parameter estimate.
I am trying to calibrate my battery parameters using the MBC tool, but I encountered the following issue. I input the HPPC experimental data into the MBC tool and waited for it to fit the parameters, such as Em, R0, R1, etc. However, the results were disappointing. The fitting did not converge, and the curve could not be fitted at all. The result is shown in Figure 1 below. Could you please help me identify the issue? Is it a problem with my parameter settings in the MBC tool, or is there an issue with my HPPC experimental data?I am trying to calibrate my battery parameters using the MBC tool, but I encountered the following issue. I input the HPPC experimental data into the MBC tool and waited for it to fit the parameters, such as Em, R0, R1, etc. However, the results were disappointing. The fitting did not converge, and the curve could not be fitted at all. The result is shown in Figure 1 below. Could you please help me identify the issue? Is it a problem with my parameter settings in the MBC tool, or is there an issue with my HPPC experimental data? I am trying to calibrate my battery parameters using the MBC tool, but I encountered the following issue. I input the HPPC experimental data into the MBC tool and waited for it to fit the parameters, such as Em, R0, R1, etc. However, the results were disappointing. The fitting did not converge, and the curve could not be fitted at all. The result is shown in Figure 1 below. Could you please help me identify the issue? Is it a problem with my parameter settings in the MBC tool, or is there an issue with my HPPC experimental data? simscape, mbc, battery_system_management MATLAB Answers — New Questions
Code inspector not able to verify the state flow model
I am able to run model and generate the code, but when i run the code inspector, not able to varifiy the code, its failing
Please let me know, anyone faced this issue beforeI am able to run model and generate the code, but when i run the code inspector, not able to varifiy the code, its failing
Please let me know, anyone faced this issue before I am able to run model and generate the code, but when i run the code inspector, not able to varifiy the code, its failing
Please let me know, anyone faced this issue before state flow not able to verify the state flow chart MATLAB Answers — New Questions
C++ compiler errors TFlite
Good afternoon,
I have been trying to deploy a tflite model onto my raspberry pi using MATLAB 2024a.
To start i am using:
Example code (SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample).
Mex code setup i am using ‘Microsoft Visual C++ 2022’
Built Tensorflow 2.15 on Windows with Bazel 6.10
Downloaded and setup Raspberry pi Matlab config
Raspberry pi 32 bit bullseye (python 3.9.2)
created all of the paths accordingly as stated in Prerequisites for Deep Learning with TensorFlow Lite Models
When i run the code it has no errors. The problem starts once i run:
codegen -config cfg tflite_semantic_predict -args ones(257,257,3,’single’)
The error is as follows:
codegen -config cfg tflite_semantic_predict -args ones(257,257,3,’single’)
————————————————————————
Error executing command "touch -c /home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/*.*;make -j$(($(nproc)+1)) -Otarget -f tflite_semantic_predict_rtw.mk all MATLAB_WORKSPACE="/home/bmblaylock42/MATLAB_ws/R2024a" LINUX_TARGET_LIBS_MACRO="" -C /home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict LC_ALL=C". Details:
STDERR: In file included from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/tensorflow/lite/core/model.h:26,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/tensorflow/lite/core/kernels/register.h:22,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/kernels/register.h:18,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/invokeinterpreter.hpp:16,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/invokeinterpreter.cpp:6:
/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/tensorflow/lite/core/interpreter_builder.h:33:10: fatal error: flatbuffers/flatbuffers.h: No such file or directory
33 | #include "flatbuffers/flatbuffers.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [tflite_semantic_predict_rtw.mk:382: invokeinterpreter.cpp.o] Error 1
make: *** Waiting for unfinished jobs….
In file included from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/tensorflow/lite/core/model.h:26,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/tensorflow/lite/core/kernels/register.h:22,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/kernels/register.h:18,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/invokeinterpreter.hpp:16,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/tflite_semantic_predict.cpp:15:
/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/tensorflow/lite/core/interpreter_builder.h:33:10: fatal error: flatbuffers/flatbuffers.h: No such file or directory
33 | #include "flatbuffers/flatbuffers.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [tflite_semantic_predict_rtw.mk:398: tflite_semantic_predict.cpp.o] Error 1
STDOUT: make: Entering directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
g++ -c -MMD -MP -MF"tflite_semantic_predict_data.cpp.dep" -MT"tflite_semantic_predict_data.cpp.o" -fpermissive -O2 -DMW_NUM_CORES=4 -pthread -fopenmp -std=c++17 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=200000 -DMODEL=tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter -I -I/tensorflow/lite -I/tensorflow/lite/tools/make/downloads/flatbuffers/include -I/flatbuffers/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/ProgramData/MATLAB/SupportPackages/R2024a/toolbox/realtime/targets/raspi/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/coder/rtiostream/src/utils -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/extern/include -o "tflite_semantic_predict_data.cpp.o" "/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/tflite_semantic_predict_data.cpp"
make: Leaving directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
make: Entering directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
g++ -c -MMD -MP -MF"tflite_semantic_predict_terminate.cpp.dep" -MT"tflite_semantic_predict_terminate.cpp.o" -fpermissive -O2 -DMW_NUM_CORES=4 -pthread -fopenmp -std=c++17 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=200000 -DMODEL=tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter -I -I/tensorflow/lite -I/tensorflow/lite/tools/make/downloads/flatbuffers/include -I/flatbuffers/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/ProgramData/MATLAB/SupportPackages/R2024a/toolbox/realtime/targets/raspi/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/coder/rtiostream/src/utils -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/extern/include -o "tflite_semantic_predict_terminate.cpp.o" "/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/tflite_semantic_predict_terminate.cpp"
make: Leaving directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
make: Entering directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
g++ -c -MMD -MP -MF"tflite_semantic_predict_initialize.cpp.dep" -MT"tflite_semantic_predict_initialize.cpp.o" -fpermissive -O2 -DMW_NUM_CORES=4 -pthread -fopenmp -std=c++17 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=200000 -DMODEL=tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter -I -I/tensorflow/lite -I/tensorflow/lite/tools/make/downloads/flatbuffers/include -I/flatbuffers/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/ProgramData/MATLAB/SupportPackages/R2024a/toolbox/realtime/targets/raspi/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/coder/rtiostream/src/utils -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/extern/include -o "tflite_semantic_predict_initialize.cpp.o" "/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/tflite_semantic_predict_initialize.cpp"
make: Leaving directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
make: Entering directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
g++ -c -MMD -MP -MF"invokeinterpreter.cpp.dep" -MT"invokeinterpreter.cpp.o" -fpermissive -O2 -DMW_NUM_CORES=4 -pthread -fopenmp -std=c++17 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=200000 -DMODEL=tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter -I -I/tensorflow/lite -I/tensorflow/lite/tools/make/downloads/flatbuffers/include -I/flatbuffers/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/ProgramData/MATLAB/SupportPackages/R2024a/toolbox/realtime/targets/raspi/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/coder/rtiostream/src/utils -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/extern/include -o "invokeinterpreter.cpp.o" "/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/invokeinterpreter.cpp"
make: Leaving directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
make: Entering directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
g++ -c -MMD -MP -MF"tflite_semantic_predict.cpp.dep" -MT"tflite_semantic_predict.cpp.o" -fpermissive -O2 -DMW_NUM_CORES=4 -pthread -fopenmp -std=c++17 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=200000 -DMODEL=tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter -I -I/tensorflow/lite -I/tensorflow/lite/tools/make/downloads/flatbuffers/include -I/flatbuffers/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/ProgramData/MATLAB/SupportPackages/R2024a/toolbox/realtime/targets/raspi/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/coder/rtiostream/src/utils -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/extern/include -o "tflite_semantic_predict.cpp.o" "/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/tflite_semantic_predict.cpp"
make: Leaving directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
————————————————————————
Build error: C++ compiler produced errors. See the Build Log for further details.
More information
Code generation failed: View Error Report
Error using codegen
Thank you so much i have tried to download the flatbuffers by CMake and bazel but i had no luck since they are 64 bit codes and mine is a 32bit aarch64.Good afternoon,
I have been trying to deploy a tflite model onto my raspberry pi using MATLAB 2024a.
To start i am using:
Example code (SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample).
Mex code setup i am using ‘Microsoft Visual C++ 2022’
Built Tensorflow 2.15 on Windows with Bazel 6.10
Downloaded and setup Raspberry pi Matlab config
Raspberry pi 32 bit bullseye (python 3.9.2)
created all of the paths accordingly as stated in Prerequisites for Deep Learning with TensorFlow Lite Models
When i run the code it has no errors. The problem starts once i run:
codegen -config cfg tflite_semantic_predict -args ones(257,257,3,’single’)
The error is as follows:
codegen -config cfg tflite_semantic_predict -args ones(257,257,3,’single’)
————————————————————————
Error executing command "touch -c /home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/*.*;make -j$(($(nproc)+1)) -Otarget -f tflite_semantic_predict_rtw.mk all MATLAB_WORKSPACE="/home/bmblaylock42/MATLAB_ws/R2024a" LINUX_TARGET_LIBS_MACRO="" -C /home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict LC_ALL=C". Details:
STDERR: In file included from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/tensorflow/lite/core/model.h:26,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/tensorflow/lite/core/kernels/register.h:22,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/kernels/register.h:18,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/invokeinterpreter.hpp:16,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/invokeinterpreter.cpp:6:
/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/tensorflow/lite/core/interpreter_builder.h:33:10: fatal error: flatbuffers/flatbuffers.h: No such file or directory
33 | #include "flatbuffers/flatbuffers.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [tflite_semantic_predict_rtw.mk:382: invokeinterpreter.cpp.o] Error 1
make: *** Waiting for unfinished jobs….
In file included from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/tensorflow/lite/core/model.h:26,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/tensorflow/lite/core/kernels/register.h:22,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/kernels/register.h:18,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/invokeinterpreter.hpp:16,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/tflite_semantic_predict.cpp:15:
/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/tensorflow/lite/core/interpreter_builder.h:33:10: fatal error: flatbuffers/flatbuffers.h: No such file or directory
33 | #include "flatbuffers/flatbuffers.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [tflite_semantic_predict_rtw.mk:398: tflite_semantic_predict.cpp.o] Error 1
STDOUT: make: Entering directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
g++ -c -MMD -MP -MF"tflite_semantic_predict_data.cpp.dep" -MT"tflite_semantic_predict_data.cpp.o" -fpermissive -O2 -DMW_NUM_CORES=4 -pthread -fopenmp -std=c++17 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=200000 -DMODEL=tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter -I -I/tensorflow/lite -I/tensorflow/lite/tools/make/downloads/flatbuffers/include -I/flatbuffers/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/ProgramData/MATLAB/SupportPackages/R2024a/toolbox/realtime/targets/raspi/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/coder/rtiostream/src/utils -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/extern/include -o "tflite_semantic_predict_data.cpp.o" "/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/tflite_semantic_predict_data.cpp"
make: Leaving directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
make: Entering directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
g++ -c -MMD -MP -MF"tflite_semantic_predict_terminate.cpp.dep" -MT"tflite_semantic_predict_terminate.cpp.o" -fpermissive -O2 -DMW_NUM_CORES=4 -pthread -fopenmp -std=c++17 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=200000 -DMODEL=tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter -I -I/tensorflow/lite -I/tensorflow/lite/tools/make/downloads/flatbuffers/include -I/flatbuffers/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/ProgramData/MATLAB/SupportPackages/R2024a/toolbox/realtime/targets/raspi/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/coder/rtiostream/src/utils -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/extern/include -o "tflite_semantic_predict_terminate.cpp.o" "/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/tflite_semantic_predict_terminate.cpp"
make: Leaving directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
make: Entering directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
g++ -c -MMD -MP -MF"tflite_semantic_predict_initialize.cpp.dep" -MT"tflite_semantic_predict_initialize.cpp.o" -fpermissive -O2 -DMW_NUM_CORES=4 -pthread -fopenmp -std=c++17 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=200000 -DMODEL=tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter -I -I/tensorflow/lite -I/tensorflow/lite/tools/make/downloads/flatbuffers/include -I/flatbuffers/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/ProgramData/MATLAB/SupportPackages/R2024a/toolbox/realtime/targets/raspi/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/coder/rtiostream/src/utils -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/extern/include -o "tflite_semantic_predict_initialize.cpp.o" "/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/tflite_semantic_predict_initialize.cpp"
make: Leaving directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
make: Entering directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
g++ -c -MMD -MP -MF"invokeinterpreter.cpp.dep" -MT"invokeinterpreter.cpp.o" -fpermissive -O2 -DMW_NUM_CORES=4 -pthread -fopenmp -std=c++17 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=200000 -DMODEL=tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter -I -I/tensorflow/lite -I/tensorflow/lite/tools/make/downloads/flatbuffers/include -I/flatbuffers/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/ProgramData/MATLAB/SupportPackages/R2024a/toolbox/realtime/targets/raspi/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/coder/rtiostream/src/utils -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/extern/include -o "invokeinterpreter.cpp.o" "/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/invokeinterpreter.cpp"
make: Leaving directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
make: Entering directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
g++ -c -MMD -MP -MF"tflite_semantic_predict.cpp.dep" -MT"tflite_semantic_predict.cpp.o" -fpermissive -O2 -DMW_NUM_CORES=4 -pthread -fopenmp -std=c++17 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=200000 -DMODEL=tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter -I -I/tensorflow/lite -I/tensorflow/lite/tools/make/downloads/flatbuffers/include -I/flatbuffers/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/ProgramData/MATLAB/SupportPackages/R2024a/toolbox/realtime/targets/raspi/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/coder/rtiostream/src/utils -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/extern/include -o "tflite_semantic_predict.cpp.o" "/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/tflite_semantic_predict.cpp"
make: Leaving directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
————————————————————————
Build error: C++ compiler produced errors. See the Build Log for further details.
More information
Code generation failed: View Error Report
Error using codegen
Thank you so much i have tried to download the flatbuffers by CMake and bazel but i had no luck since they are 64 bit codes and mine is a 32bit aarch64. Good afternoon,
I have been trying to deploy a tflite model onto my raspberry pi using MATLAB 2024a.
To start i am using:
Example code (SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample).
Mex code setup i am using ‘Microsoft Visual C++ 2022’
Built Tensorflow 2.15 on Windows with Bazel 6.10
Downloaded and setup Raspberry pi Matlab config
Raspberry pi 32 bit bullseye (python 3.9.2)
created all of the paths accordingly as stated in Prerequisites for Deep Learning with TensorFlow Lite Models
When i run the code it has no errors. The problem starts once i run:
codegen -config cfg tflite_semantic_predict -args ones(257,257,3,’single’)
The error is as follows:
codegen -config cfg tflite_semantic_predict -args ones(257,257,3,’single’)
————————————————————————
Error executing command "touch -c /home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/*.*;make -j$(($(nproc)+1)) -Otarget -f tflite_semantic_predict_rtw.mk all MATLAB_WORKSPACE="/home/bmblaylock42/MATLAB_ws/R2024a" LINUX_TARGET_LIBS_MACRO="" -C /home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict LC_ALL=C". Details:
STDERR: In file included from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/tensorflow/lite/core/model.h:26,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/tensorflow/lite/core/kernels/register.h:22,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/kernels/register.h:18,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/invokeinterpreter.hpp:16,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/invokeinterpreter.cpp:6:
/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/tensorflow/lite/core/interpreter_builder.h:33:10: fatal error: flatbuffers/flatbuffers.h: No such file or directory
33 | #include "flatbuffers/flatbuffers.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [tflite_semantic_predict_rtw.mk:382: invokeinterpreter.cpp.o] Error 1
make: *** Waiting for unfinished jobs….
In file included from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/tensorflow/lite/core/model.h:26,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/tensorflow/lite/core/kernels/register.h:22,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/kernels/register.h:18,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/invokeinterpreter.hpp:16,
from /home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/tflite_semantic_predict.cpp:15:
/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter/tensorflow/lite/core/interpreter_builder.h:33:10: fatal error: flatbuffers/flatbuffers.h: No such file or directory
33 | #include "flatbuffers/flatbuffers.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [tflite_semantic_predict_rtw.mk:398: tflite_semantic_predict.cpp.o] Error 1
STDOUT: make: Entering directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
g++ -c -MMD -MP -MF"tflite_semantic_predict_data.cpp.dep" -MT"tflite_semantic_predict_data.cpp.o" -fpermissive -O2 -DMW_NUM_CORES=4 -pthread -fopenmp -std=c++17 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=200000 -DMODEL=tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter -I -I/tensorflow/lite -I/tensorflow/lite/tools/make/downloads/flatbuffers/include -I/flatbuffers/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/ProgramData/MATLAB/SupportPackages/R2024a/toolbox/realtime/targets/raspi/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/coder/rtiostream/src/utils -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/extern/include -o "tflite_semantic_predict_data.cpp.o" "/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/tflite_semantic_predict_data.cpp"
make: Leaving directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
make: Entering directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
g++ -c -MMD -MP -MF"tflite_semantic_predict_terminate.cpp.dep" -MT"tflite_semantic_predict_terminate.cpp.o" -fpermissive -O2 -DMW_NUM_CORES=4 -pthread -fopenmp -std=c++17 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=200000 -DMODEL=tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter -I -I/tensorflow/lite -I/tensorflow/lite/tools/make/downloads/flatbuffers/include -I/flatbuffers/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/ProgramData/MATLAB/SupportPackages/R2024a/toolbox/realtime/targets/raspi/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/coder/rtiostream/src/utils -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/extern/include -o "tflite_semantic_predict_terminate.cpp.o" "/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/tflite_semantic_predict_terminate.cpp"
make: Leaving directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
make: Entering directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
g++ -c -MMD -MP -MF"tflite_semantic_predict_initialize.cpp.dep" -MT"tflite_semantic_predict_initialize.cpp.o" -fpermissive -O2 -DMW_NUM_CORES=4 -pthread -fopenmp -std=c++17 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=200000 -DMODEL=tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter -I -I/tensorflow/lite -I/tensorflow/lite/tools/make/downloads/flatbuffers/include -I/flatbuffers/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/ProgramData/MATLAB/SupportPackages/R2024a/toolbox/realtime/targets/raspi/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/coder/rtiostream/src/utils -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/extern/include -o "tflite_semantic_predict_initialize.cpp.o" "/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/tflite_semantic_predict_initialize.cpp"
make: Leaving directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
make: Entering directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
g++ -c -MMD -MP -MF"invokeinterpreter.cpp.dep" -MT"invokeinterpreter.cpp.o" -fpermissive -O2 -DMW_NUM_CORES=4 -pthread -fopenmp -std=c++17 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=200000 -DMODEL=tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter -I -I/tensorflow/lite -I/tensorflow/lite/tools/make/downloads/flatbuffers/include -I/flatbuffers/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/ProgramData/MATLAB/SupportPackages/R2024a/toolbox/realtime/targets/raspi/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/coder/rtiostream/src/utils -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/extern/include -o "invokeinterpreter.cpp.o" "/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/invokeinterpreter.cpp"
make: Leaving directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
make: Entering directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
g++ -c -MMD -MP -MF"tflite_semantic_predict.cpp.dep" -MT"tflite_semantic_predict.cpp.o" -fpermissive -O2 -DMW_NUM_CORES=4 -pthread -fopenmp -std=c++17 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=200000 -DMODEL=tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/tflite_interface/invokeinterpreter/export/include/invokeinterpreter -I -I/tensorflow/lite -I/tensorflow/lite/tools/make/downloads/flatbuffers/include -I/flatbuffers/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/ProgramData/MATLAB/SupportPackages/R2024a/toolbox/realtime/targets/raspi/include -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/toolbox/coder/rtiostream/src/utils -I/home/bmblaylock42/MATLAB_ws/R2024a/C/Program_Files/MATLAB/R2024a/extern/include -o "tflite_semantic_predict.cpp.o" "/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict/tflite_semantic_predict.cpp"
make: Leaving directory ‘/home/bmblaylock42/MATLAB_ws/R2024a/C/Users/BransonBlaylock/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample/codegen/lib/tflite_semantic_predict’
————————————————————————
Build error: C++ compiler produced errors. See the Build Log for further details.
More information
Code generation failed: View Error Report
Error using codegen
Thank you so much i have tried to download the flatbuffers by CMake and bazel but i had no luck since they are 64 bit codes and mine is a 32bit aarch64. tensorflow, matlab, code generation MATLAB Answers — New Questions
why is my loop printing 0 instead of a value, not sure which part of the code is incorrect
right now the code is at an increment of 15 to test, but the final incremment will be 0.01
code needs to have an if statement within the while loop.
%range is the maximum achievable horizontal distance
% range angle is the angle that yields the maximum horizontaal distance
% use a whilel loop with a nested if statement to compute the maximum
% landing distance (range) ange the angle corrsesponding to the maximum
% landing distance (rangle angle) of the ME En 1010 ping pong cannon
function [range, rangeAngle] = ProjectileRange(d1, d2, v0)
thetaL = 90;
range = 0;
rangeAngle = 0;
[xLand] = LandingDistance(d1, d2, v0, thetaL);
while thetaL <= 90;
if xLand > range
range = xLand
rangeAngle = thetaL
end
thetaL = thetaL + 15;
end
end
%% test
d1 = 0.0876;
d2 = 0.1190;
v0 = 3.2;
[range, rangeAngle] = ProjectileRange(d1, d2, v0);
fprintf(‘The range is %.2f m at a launch angle of %.2f degrees’, range, rangeAngle)
this is what it prints:
The range is 0.00 m at a launch angle of 0.00 degrees>>
I need it to print "the range is 1.29 m at a launch angle of 41.6 degrees" when it has an incrememnt of 0.01right now the code is at an increment of 15 to test, but the final incremment will be 0.01
code needs to have an if statement within the while loop.
%range is the maximum achievable horizontal distance
% range angle is the angle that yields the maximum horizontaal distance
% use a whilel loop with a nested if statement to compute the maximum
% landing distance (range) ange the angle corrsesponding to the maximum
% landing distance (rangle angle) of the ME En 1010 ping pong cannon
function [range, rangeAngle] = ProjectileRange(d1, d2, v0)
thetaL = 90;
range = 0;
rangeAngle = 0;
[xLand] = LandingDistance(d1, d2, v0, thetaL);
while thetaL <= 90;
if xLand > range
range = xLand
rangeAngle = thetaL
end
thetaL = thetaL + 15;
end
end
%% test
d1 = 0.0876;
d2 = 0.1190;
v0 = 3.2;
[range, rangeAngle] = ProjectileRange(d1, d2, v0);
fprintf(‘The range is %.2f m at a launch angle of %.2f degrees’, range, rangeAngle)
this is what it prints:
The range is 0.00 m at a launch angle of 0.00 degrees>>
I need it to print "the range is 1.29 m at a launch angle of 41.6 degrees" when it has an incrememnt of 0.01 right now the code is at an increment of 15 to test, but the final incremment will be 0.01
code needs to have an if statement within the while loop.
%range is the maximum achievable horizontal distance
% range angle is the angle that yields the maximum horizontaal distance
% use a whilel loop with a nested if statement to compute the maximum
% landing distance (range) ange the angle corrsesponding to the maximum
% landing distance (rangle angle) of the ME En 1010 ping pong cannon
function [range, rangeAngle] = ProjectileRange(d1, d2, v0)
thetaL = 90;
range = 0;
rangeAngle = 0;
[xLand] = LandingDistance(d1, d2, v0, thetaL);
while thetaL <= 90;
if xLand > range
range = xLand
rangeAngle = thetaL
end
thetaL = thetaL + 15;
end
end
%% test
d1 = 0.0876;
d2 = 0.1190;
v0 = 3.2;
[range, rangeAngle] = ProjectileRange(d1, d2, v0);
fprintf(‘The range is %.2f m at a launch angle of %.2f degrees’, range, rangeAngle)
this is what it prints:
The range is 0.00 m at a launch angle of 0.00 degrees>>
I need it to print "the range is 1.29 m at a launch angle of 41.6 degrees" when it has an incrememnt of 0.01 while/if loop, answer is 0 when it should be a value MATLAB Answers — New Questions
HMM Training for estimating transition and emission matrices
Hi all, I am trying to use the hmmtrain to learn the emission (emis) and transition (trans) matrices for a power dataset in dBm and subsequently generate data based on the emis and trans generated.
For now, I have discretized the noise power values, using integers to represent each bin of power values and to generate a sequence of emissions (seq) based on the discretized values. But after implementing the hmmtrain to generate an estimated trans and emis that depicts seq, I am unable to generate similar seqs using the estimated trans and emis (using hmmgenerate). In the sequence of states, hmmgenerate basically produces very few outcomes depicting state 1 leaving the rest in state 2. This does not correspond with my dataset which is about 800 and comprised of a whole lot more of state 1 outcomes than the model depicts. I need help/advice with this please.Hi all, I am trying to use the hmmtrain to learn the emission (emis) and transition (trans) matrices for a power dataset in dBm and subsequently generate data based on the emis and trans generated.
For now, I have discretized the noise power values, using integers to represent each bin of power values and to generate a sequence of emissions (seq) based on the discretized values. But after implementing the hmmtrain to generate an estimated trans and emis that depicts seq, I am unable to generate similar seqs using the estimated trans and emis (using hmmgenerate). In the sequence of states, hmmgenerate basically produces very few outcomes depicting state 1 leaving the rest in state 2. This does not correspond with my dataset which is about 800 and comprised of a whole lot more of state 1 outcomes than the model depicts. I need help/advice with this please. Hi all, I am trying to use the hmmtrain to learn the emission (emis) and transition (trans) matrices for a power dataset in dBm and subsequently generate data based on the emis and trans generated.
For now, I have discretized the noise power values, using integers to represent each bin of power values and to generate a sequence of emissions (seq) based on the discretized values. But after implementing the hmmtrain to generate an estimated trans and emis that depicts seq, I am unable to generate similar seqs using the estimated trans and emis (using hmmgenerate). In the sequence of states, hmmgenerate basically produces very few outcomes depicting state 1 leaving the rest in state 2. This does not correspond with my dataset which is about 800 and comprised of a whole lot more of state 1 outcomes than the model depicts. I need help/advice with this please. hmmtrain, hmmgenerate, impulsive noise MATLAB Answers — New Questions
Error generating MEX PIL due to missing header file for deployment of TFLite model to Raspberry Pi
Hi!
I am encountering a problem when I am trying to deploy a TFLite mode for semantic segmentation on Raspberry Pi. I was following this example by following openExample(‘deeplearning_shared/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample’)
Before running this example, I have installed the TFLite library on both the local Windows computer directly under "C:tensorflow-2.15.0" following this link:
https://www.mathworks.com/matlabcentral/answers/1631265-matlab-coder-how-do-i-build-tensorflow-lite-for-deep-learning-c-code-generation-and-deployment
and Raspberry Pi 4b (buster; 32bit OS) under "/home/pi/tensorflow/tensorflow/" following this:
https://qengineering.eu/install-tensorflow-2-lite-on-raspberry-pi-4.html
Additionally, the environment variables are set on both the local and raspi machines according to:
https://www.mathworks.com/help/deeplearning/ug/prerequisites-for-deep-learning-with-tensorflow-lite-models.html
While I had no problem with generating the MEX file on the local Windows computer with this section of codes in the example:
cfg = coder.config(‘mex’);
cfg.TargetLang = ‘C++’;
codegen -config cfg tflite_semantic_predict -args ones(257, 257,3,’single’)
I encountered errors when I tried to generate the MEX PIL function through
cfg = coder.config(‘lib’,’ecoder’,true);
cfg.TargetLang = ‘C++’;
cfg.VerificationMode = ‘PIL’;
hw = coder.hardware(‘Raspberry Pi’);
cfg.Hardware = hw;
codegen -config cfg tflite_semantic_predict -args ones(257,257,3,’single’)
I have attached the entire error message in the txt file. Part of the error message reads:
fatal error: kernels/register.h: No such file or directory
#include "kernels/register.h"
However, when I searched the directories indicated by the environment variables, I could find the kernels/register.h file on both the Windows and RPi machines under the PATH (in Windows) or LD_LIBRARY_PATH (in RPi) variables. Please see the attached screenshots.
Here is how I set the environmental variables. On RPI, I executed:
export TFLITE_PATH="/home/pi/tensorflow/tensorflow"
export LD_LIBRARY_PATH="/home/pi/tensorflow/tensorflow/tensorflow/lite"
export TFLITE_MODEL_PATH="/home/pi"
and on Windows, I directly edited the environmental variable TFLITE_PATH and amended Path variable.
I’d appreciate any advice on how to resolve this missing header file issue by MATLAB coder.
Thank you all!Hi!
I am encountering a problem when I am trying to deploy a TFLite mode for semantic segmentation on Raspberry Pi. I was following this example by following openExample(‘deeplearning_shared/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample’)
Before running this example, I have installed the TFLite library on both the local Windows computer directly under "C:tensorflow-2.15.0" following this link:
https://www.mathworks.com/matlabcentral/answers/1631265-matlab-coder-how-do-i-build-tensorflow-lite-for-deep-learning-c-code-generation-and-deployment
and Raspberry Pi 4b (buster; 32bit OS) under "/home/pi/tensorflow/tensorflow/" following this:
https://qengineering.eu/install-tensorflow-2-lite-on-raspberry-pi-4.html
Additionally, the environment variables are set on both the local and raspi machines according to:
https://www.mathworks.com/help/deeplearning/ug/prerequisites-for-deep-learning-with-tensorflow-lite-models.html
While I had no problem with generating the MEX file on the local Windows computer with this section of codes in the example:
cfg = coder.config(‘mex’);
cfg.TargetLang = ‘C++’;
codegen -config cfg tflite_semantic_predict -args ones(257, 257,3,’single’)
I encountered errors when I tried to generate the MEX PIL function through
cfg = coder.config(‘lib’,’ecoder’,true);
cfg.TargetLang = ‘C++’;
cfg.VerificationMode = ‘PIL’;
hw = coder.hardware(‘Raspberry Pi’);
cfg.Hardware = hw;
codegen -config cfg tflite_semantic_predict -args ones(257,257,3,’single’)
I have attached the entire error message in the txt file. Part of the error message reads:
fatal error: kernels/register.h: No such file or directory
#include "kernels/register.h"
However, when I searched the directories indicated by the environment variables, I could find the kernels/register.h file on both the Windows and RPi machines under the PATH (in Windows) or LD_LIBRARY_PATH (in RPi) variables. Please see the attached screenshots.
Here is how I set the environmental variables. On RPI, I executed:
export TFLITE_PATH="/home/pi/tensorflow/tensorflow"
export LD_LIBRARY_PATH="/home/pi/tensorflow/tensorflow/tensorflow/lite"
export TFLITE_MODEL_PATH="/home/pi"
and on Windows, I directly edited the environmental variable TFLITE_PATH and amended Path variable.
I’d appreciate any advice on how to resolve this missing header file issue by MATLAB coder.
Thank you all! Hi!
I am encountering a problem when I am trying to deploy a TFLite mode for semantic segmentation on Raspberry Pi. I was following this example by following openExample(‘deeplearning_shared/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample’)
Before running this example, I have installed the TFLite library on both the local Windows computer directly under "C:tensorflow-2.15.0" following this link:
https://www.mathworks.com/matlabcentral/answers/1631265-matlab-coder-how-do-i-build-tensorflow-lite-for-deep-learning-c-code-generation-and-deployment
and Raspberry Pi 4b (buster; 32bit OS) under "/home/pi/tensorflow/tensorflow/" following this:
https://qengineering.eu/install-tensorflow-2-lite-on-raspberry-pi-4.html
Additionally, the environment variables are set on both the local and raspi machines according to:
https://www.mathworks.com/help/deeplearning/ug/prerequisites-for-deep-learning-with-tensorflow-lite-models.html
While I had no problem with generating the MEX file on the local Windows computer with this section of codes in the example:
cfg = coder.config(‘mex’);
cfg.TargetLang = ‘C++’;
codegen -config cfg tflite_semantic_predict -args ones(257, 257,3,’single’)
I encountered errors when I tried to generate the MEX PIL function through
cfg = coder.config(‘lib’,’ecoder’,true);
cfg.TargetLang = ‘C++’;
cfg.VerificationMode = ‘PIL’;
hw = coder.hardware(‘Raspberry Pi’);
cfg.Hardware = hw;
codegen -config cfg tflite_semantic_predict -args ones(257,257,3,’single’)
I have attached the entire error message in the txt file. Part of the error message reads:
fatal error: kernels/register.h: No such file or directory
#include "kernels/register.h"
However, when I searched the directories indicated by the environment variables, I could find the kernels/register.h file on both the Windows and RPi machines under the PATH (in Windows) or LD_LIBRARY_PATH (in RPi) variables. Please see the attached screenshots.
Here is how I set the environmental variables. On RPI, I executed:
export TFLITE_PATH="/home/pi/tensorflow/tensorflow"
export LD_LIBRARY_PATH="/home/pi/tensorflow/tensorflow/tensorflow/lite"
export TFLITE_MODEL_PATH="/home/pi"
and on Windows, I directly edited the environmental variable TFLITE_PATH and amended Path variable.
I’d appreciate any advice on how to resolve this missing header file issue by MATLAB coder.
Thank you all! tflite, raspberry pi, deploy, semantic segmentation MATLAB Answers — New Questions
Subdivide a figure window into two rows and one column?
I am trying to use the subplot command for class and I’m not sure if the plot is displaying properly based on the code I am writing.
% 1) Subdivide a figure window into two rows and one column.
subplot(5,4,2)I am trying to use the subplot command for class and I’m not sure if the plot is displaying properly based on the code I am writing.
% 1) Subdivide a figure window into two rows and one column.
subplot(5,4,2) I am trying to use the subplot command for class and I’m not sure if the plot is displaying properly based on the code I am writing.
% 1) Subdivide a figure window into two rows and one column.
subplot(5,4,2) subplot MATLAB Answers — New Questions
I am calling outside functions for this code, but when I am getting an error saying I have too many output arguments. I think the error is within my function LandingDistance
%% problem 2
% user-defined function to compute the horizontal distance
% traveled by a projectile knowing the launch angle, the initial velocity,
% and geometric parameters defining the initial coordinates of the projectile.
d1 = 0.0876;
d2 = 0.1190;
v0 = 3.2;
thetaL = 50;
g = 9.81; % gravitational acceleration in m/s^2
% call initial coords function and initial velocity function
[x0, y0] = InitialCoords(d1, d2, thetaL); % input units: m, m, degrees, output units: m
[v0x, v0y] = InitialVelocityComponents(v0, thetaL); % input units: m/s de,grees, output units: m/s
%Solve the y equation for tLand by calling your Quadratic function.
a = -0.5*g; % g = acceleration due to gravity in m/s^2
b = v0y; % initial velocity in y direction
c = y0; % initial y position
plusOrMinus = -1;
root = Quadratic(a, b, c, plusOrMinus); % neg root
tLand = root;
% plug tLand into the x eqn to get xLand
xLand = LandingDistance(d1, d2, v0, thetaL);
fprintf(‘For launch angle = %.1f degrees and v0 = %.1f m/s, the landing distance is %.2f m n’, thetaL, v0, xLand)
Error using LandingDistance
Too many output arguments.
Error in HW3_projectile (line 36)
xLand = LandingDistance(d1, d2, v0, thetaL);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_____________________________________
function code
% landing distance function
function LandingDistance(d1, d2, v0, thetaL)
% x_Land –> the horizontal distance traveled by the projectile
g = 9.81; % gravitational acceleration in m/s^2
[x0, y0] = InitialCoords(d1, d2, thetaL) % input units: m, m, degrees, output units: m
[v0x, v0y] = InitialVelocityComponents(v0, thetaL) % input units: m/s de,grees, output units: m/s
a = -0.5*g; % g = acceleration due to gravity in m/s^2
b = v0y; % initial velocity in y direction
c = y0; % initial y position
plusOrMinus = -1;
[root] = Quadratic(a, b, c, plusOrMinus); % neg root
tLand = root
xLand = x0 + (v0x*tLand)
end
Not enough input arguments.
Error in LandingDistance (line 6)
[x0, y0] = InitialCoords(d1, d2, thetaL)
^^
>>%% problem 2
% user-defined function to compute the horizontal distance
% traveled by a projectile knowing the launch angle, the initial velocity,
% and geometric parameters defining the initial coordinates of the projectile.
d1 = 0.0876;
d2 = 0.1190;
v0 = 3.2;
thetaL = 50;
g = 9.81; % gravitational acceleration in m/s^2
% call initial coords function and initial velocity function
[x0, y0] = InitialCoords(d1, d2, thetaL); % input units: m, m, degrees, output units: m
[v0x, v0y] = InitialVelocityComponents(v0, thetaL); % input units: m/s de,grees, output units: m/s
%Solve the y equation for tLand by calling your Quadratic function.
a = -0.5*g; % g = acceleration due to gravity in m/s^2
b = v0y; % initial velocity in y direction
c = y0; % initial y position
plusOrMinus = -1;
root = Quadratic(a, b, c, plusOrMinus); % neg root
tLand = root;
% plug tLand into the x eqn to get xLand
xLand = LandingDistance(d1, d2, v0, thetaL);
fprintf(‘For launch angle = %.1f degrees and v0 = %.1f m/s, the landing distance is %.2f m n’, thetaL, v0, xLand)
Error using LandingDistance
Too many output arguments.
Error in HW3_projectile (line 36)
xLand = LandingDistance(d1, d2, v0, thetaL);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_____________________________________
function code
% landing distance function
function LandingDistance(d1, d2, v0, thetaL)
% x_Land –> the horizontal distance traveled by the projectile
g = 9.81; % gravitational acceleration in m/s^2
[x0, y0] = InitialCoords(d1, d2, thetaL) % input units: m, m, degrees, output units: m
[v0x, v0y] = InitialVelocityComponents(v0, thetaL) % input units: m/s de,grees, output units: m/s
a = -0.5*g; % g = acceleration due to gravity in m/s^2
b = v0y; % initial velocity in y direction
c = y0; % initial y position
plusOrMinus = -1;
[root] = Quadratic(a, b, c, plusOrMinus); % neg root
tLand = root
xLand = x0 + (v0x*tLand)
end
Not enough input arguments.
Error in LandingDistance (line 6)
[x0, y0] = InitialCoords(d1, d2, thetaL)
^^
>> %% problem 2
% user-defined function to compute the horizontal distance
% traveled by a projectile knowing the launch angle, the initial velocity,
% and geometric parameters defining the initial coordinates of the projectile.
d1 = 0.0876;
d2 = 0.1190;
v0 = 3.2;
thetaL = 50;
g = 9.81; % gravitational acceleration in m/s^2
% call initial coords function and initial velocity function
[x0, y0] = InitialCoords(d1, d2, thetaL); % input units: m, m, degrees, output units: m
[v0x, v0y] = InitialVelocityComponents(v0, thetaL); % input units: m/s de,grees, output units: m/s
%Solve the y equation for tLand by calling your Quadratic function.
a = -0.5*g; % g = acceleration due to gravity in m/s^2
b = v0y; % initial velocity in y direction
c = y0; % initial y position
plusOrMinus = -1;
root = Quadratic(a, b, c, plusOrMinus); % neg root
tLand = root;
% plug tLand into the x eqn to get xLand
xLand = LandingDistance(d1, d2, v0, thetaL);
fprintf(‘For launch angle = %.1f degrees and v0 = %.1f m/s, the landing distance is %.2f m n’, thetaL, v0, xLand)
Error using LandingDistance
Too many output arguments.
Error in HW3_projectile (line 36)
xLand = LandingDistance(d1, d2, v0, thetaL);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_____________________________________
function code
% landing distance function
function LandingDistance(d1, d2, v0, thetaL)
% x_Land –> the horizontal distance traveled by the projectile
g = 9.81; % gravitational acceleration in m/s^2
[x0, y0] = InitialCoords(d1, d2, thetaL) % input units: m, m, degrees, output units: m
[v0x, v0y] = InitialVelocityComponents(v0, thetaL) % input units: m/s de,grees, output units: m/s
a = -0.5*g; % g = acceleration due to gravity in m/s^2
b = v0y; % initial velocity in y direction
c = y0; % initial y position
plusOrMinus = -1;
[root] = Quadratic(a, b, c, plusOrMinus); % neg root
tLand = root
xLand = x0 + (v0x*tLand)
end
Not enough input arguments.
Error in LandingDistance (line 6)
[x0, y0] = InitialCoords(d1, d2, thetaL)
^^
>> error, not enough inputs, too many outputs MATLAB Answers — New Questions
Problem with Code for my coursera course
This is the question I am trying to solve and I also uploading the code i have written and error I am getting, Please help me the error please.This is the question I am trying to solve and I also uploading the code i have written and error I am getting, Please help me the error please. This is the question I am trying to solve and I also uploading the code i have written and error I am getting, Please help me the error please. code, problem, urgent MATLAB Answers — New Questions
Intel vs AMD for a new build in 2025
Hello everyone,
I’m planning a new PC build and am currently undecided about which CPU to choose.
I understand that AMD CPUs have faced some slower performance in MATLAB due to Intel MKL but I understand it was solved with the AMD AOCL? Bench instruction results also seem to show a performance difference between Intel and AMD CPUs (but couldn’t check too many).
Intel CPUs seem to have some issues which probably have been solved for 14th gen with the new BIOS updates, and 15th gen is not quite mature. Their power dissipation is quite high.
For MATLAB, I plan to use the Parallel Computing and Optimization Toolboxes. Apart from MATLAB, ANSYS or other FEA software will be the most demanding applications, and I also plan to game from time to time.
I will pair this with an RTX3070 for the moment.
I was looking at the following CPUs:
Intel Ultra 7 265k – $230 / $600
Intel I9 14900k – $390 / $650
AMD Ryzen 7 9800x3D – $474 / $750
AMD Ryzen 7 9950X – $570 /$910
(Prices listed are current and include discounts, with $ CPU / $ CPU+Mobo+RAM)
Thank you!Hello everyone,
I’m planning a new PC build and am currently undecided about which CPU to choose.
I understand that AMD CPUs have faced some slower performance in MATLAB due to Intel MKL but I understand it was solved with the AMD AOCL? Bench instruction results also seem to show a performance difference between Intel and AMD CPUs (but couldn’t check too many).
Intel CPUs seem to have some issues which probably have been solved for 14th gen with the new BIOS updates, and 15th gen is not quite mature. Their power dissipation is quite high.
For MATLAB, I plan to use the Parallel Computing and Optimization Toolboxes. Apart from MATLAB, ANSYS or other FEA software will be the most demanding applications, and I also plan to game from time to time.
I will pair this with an RTX3070 for the moment.
I was looking at the following CPUs:
Intel Ultra 7 265k – $230 / $600
Intel I9 14900k – $390 / $650
AMD Ryzen 7 9800x3D – $474 / $750
AMD Ryzen 7 9950X – $570 /$910
(Prices listed are current and include discounts, with $ CPU / $ CPU+Mobo+RAM)
Thank you! Hello everyone,
I’m planning a new PC build and am currently undecided about which CPU to choose.
I understand that AMD CPUs have faced some slower performance in MATLAB due to Intel MKL but I understand it was solved with the AMD AOCL? Bench instruction results also seem to show a performance difference between Intel and AMD CPUs (but couldn’t check too many).
Intel CPUs seem to have some issues which probably have been solved for 14th gen with the new BIOS updates, and 15th gen is not quite mature. Their power dissipation is quite high.
For MATLAB, I plan to use the Parallel Computing and Optimization Toolboxes. Apart from MATLAB, ANSYS or other FEA software will be the most demanding applications, and I also plan to game from time to time.
I will pair this with an RTX3070 for the moment.
I was looking at the following CPUs:
Intel Ultra 7 265k – $230 / $600
Intel I9 14900k – $390 / $650
AMD Ryzen 7 9800x3D – $474 / $750
AMD Ryzen 7 9950X – $570 /$910
(Prices listed are current and include discounts, with $ CPU / $ CPU+Mobo+RAM)
Thank you! parallel computing toolbox, optimization, pc build, intel vs amd, cpu MATLAB Answers — New Questions
The mesh function is not working for me in offline Matlab, but when I check this code in online Matlab, it works. What is the reason?
Post Content Post Content mesh, surf MATLAB Answers — New Questions
Simulink dashboard button matching
I’m looking for suggestions on how to approach a Simulink interface problem.
In case 1 below, both dashboard buttons have connections to constant S1 such that if you change either button, the other button will track.
In case 2 I’m looking to do something similar but with a constant and a button. If I entered 0b0 for desired state, then S2 would change to zero, and the button would shift to A. If I moved the button to B, then S2 would change back to 1, and Desired State would also change to 0b1.
This is a simplified test case of a more complex scenario I want to work up, where there is one binary input (e.g. 0b01010), and 5 buttons, and 5 constants.
In one direction, I could use a matlab function to call set_param if the binary input is changed to set the value of S2. But I am unsure about the other direction.I’m looking for suggestions on how to approach a Simulink interface problem.
In case 1 below, both dashboard buttons have connections to constant S1 such that if you change either button, the other button will track.
In case 2 I’m looking to do something similar but with a constant and a button. If I entered 0b0 for desired state, then S2 would change to zero, and the button would shift to A. If I moved the button to B, then S2 would change back to 1, and Desired State would also change to 0b1.
This is a simplified test case of a more complex scenario I want to work up, where there is one binary input (e.g. 0b01010), and 5 buttons, and 5 constants.
In one direction, I could use a matlab function to call set_param if the binary input is changed to set the value of S2. But I am unsure about the other direction. I’m looking for suggestions on how to approach a Simulink interface problem.
In case 1 below, both dashboard buttons have connections to constant S1 such that if you change either button, the other button will track.
In case 2 I’m looking to do something similar but with a constant and a button. If I entered 0b0 for desired state, then S2 would change to zero, and the button would shift to A. If I moved the button to B, then S2 would change back to 1, and Desired State would also change to 0b1.
This is a simplified test case of a more complex scenario I want to work up, where there is one binary input (e.g. 0b01010), and 5 buttons, and 5 constants.
In one direction, I could use a matlab function to call set_param if the binary input is changed to set the value of S2. But I am unsure about the other direction. simulink, dashboard, buttons, interface MATLAB Answers — New Questions
Spectrum analyser can’t plot the whole frequency-time spain
Hi there,
i try to use Spectrum Analyzer to plot the signal, which benn calculated by Short-time Fourier Transform.
However, i can’t see the whole plot in Spectrum Analyzer, that is, it should show from 0~15s, but actually it only shows 14~15s.Hi there,
i try to use Spectrum Analyzer to plot the signal, which benn calculated by Short-time Fourier Transform.
However, i can’t see the whole plot in Spectrum Analyzer, that is, it should show from 0~15s, but actually it only shows 14~15s. Hi there,
i try to use Spectrum Analyzer to plot the signal, which benn calculated by Short-time Fourier Transform.
However, i can’t see the whole plot in Spectrum Analyzer, that is, it should show from 0~15s, but actually it only shows 14~15s. fft, simulink MATLAB Answers — New Questions
MATLAB doesn’t recognize the function optimoptions
I’m getting an error at the following line:
options = optimoptions(‘ga’,’PopulationSize’,10,’MaxGenerations’,10);
The following message exemplifies the problem.
I’m using the version 9.10 (R2021a) of MATLAB and the version 4.5 (R2021a) of the Global Optimization Toolbox
Any suggestions will be appreciatedI’m getting an error at the following line:
options = optimoptions(‘ga’,’PopulationSize’,10,’MaxGenerations’,10);
The following message exemplifies the problem.
I’m using the version 9.10 (R2021a) of MATLAB and the version 4.5 (R2021a) of the Global Optimization Toolbox
Any suggestions will be appreciated I’m getting an error at the following line:
options = optimoptions(‘ga’,’PopulationSize’,10,’MaxGenerations’,10);
The following message exemplifies the problem.
I’m using the version 9.10 (R2021a) of MATLAB and the version 4.5 (R2021a) of the Global Optimization Toolbox
Any suggestions will be appreciated #unrecognized, optimoptions, #ga MATLAB Answers — New Questions