Category: News
How can I use Python in Matlab for dll usage?
I am using Python inside of MATLAB to load a DLL so I can use its functionality. I have tried almost every combination of inputs to try and make this MATLAB-Python combo work, but I have been unsuccessful. I know my DLL is good because I have used it using solely python and I have also gotten it working in MATLAB using a different set of commands, but I really want to use the MATLAB/Python combo.
Below is what I am trying to do
%% Using Python
ctypes = py.importlib.import_module(‘ctypes’);
vnx = ctypes.cdll.LoadLibrary(‘file path where dll and header files are stored vnx_fmsynth.dll’);
%% Calling these fx’s don’t work!
vnx.fnLMS_SetTestMode(0)
vnx.fnLMS_GetNumDevices()
I can assure fnLMS_SetTestMode and fnLMS_GetNumDevices, are methods within the DLL but python-matlab does not want to recognize them. I have tried over 100 combinations of trying to get the DLL to function, but I simply cannot figure out the correct syntax. When I run essentially the same lines in python however, it does work, so I am obviously doing something wrong inside of matlab.
Let me show you what does work in MATLAB with out using python.. (this does require you have a C-code compiler installed on your PC).
%% Load Libraries
cd(‘file path where dll and header files are stored’)
libName=’vnx_fmsynth’;
loadlibrary([libName,’.dll’],’vnx_LMS_api.h’)
libfunc= libfunctions(‘vnx_fmsynth’)
%% tab complete for the lazy
for i=1:length(libfunc)
libF.(libfunc{i})=libfunc{i}; % this way the auto complete from the structure’s field is the same as the library name
end
%% Calling these fx’s work!
calllib(libName, ‘fnLMS_SetTestMode’,0)
devNum=calllib(libName,libF.fnLMS_GetNumDevices)
I have included the files in .zip for you to try yourself.
the fnLMS_GetNumDevices function should response with ‘0’. the TestMode function doesn’t respond with anything, but it does functionally work. I have been told and have watched videos that running python inside of MATLAB works the same, but I am starting to question my presumptions. 🙁 Any and all help would be very much appreciated!!
I am using MATLAB 2022AI am using Python inside of MATLAB to load a DLL so I can use its functionality. I have tried almost every combination of inputs to try and make this MATLAB-Python combo work, but I have been unsuccessful. I know my DLL is good because I have used it using solely python and I have also gotten it working in MATLAB using a different set of commands, but I really want to use the MATLAB/Python combo.
Below is what I am trying to do
%% Using Python
ctypes = py.importlib.import_module(‘ctypes’);
vnx = ctypes.cdll.LoadLibrary(‘file path where dll and header files are stored vnx_fmsynth.dll’);
%% Calling these fx’s don’t work!
vnx.fnLMS_SetTestMode(0)
vnx.fnLMS_GetNumDevices()
I can assure fnLMS_SetTestMode and fnLMS_GetNumDevices, are methods within the DLL but python-matlab does not want to recognize them. I have tried over 100 combinations of trying to get the DLL to function, but I simply cannot figure out the correct syntax. When I run essentially the same lines in python however, it does work, so I am obviously doing something wrong inside of matlab.
Let me show you what does work in MATLAB with out using python.. (this does require you have a C-code compiler installed on your PC).
%% Load Libraries
cd(‘file path where dll and header files are stored’)
libName=’vnx_fmsynth’;
loadlibrary([libName,’.dll’],’vnx_LMS_api.h’)
libfunc= libfunctions(‘vnx_fmsynth’)
%% tab complete for the lazy
for i=1:length(libfunc)
libF.(libfunc{i})=libfunc{i}; % this way the auto complete from the structure’s field is the same as the library name
end
%% Calling these fx’s work!
calllib(libName, ‘fnLMS_SetTestMode’,0)
devNum=calllib(libName,libF.fnLMS_GetNumDevices)
I have included the files in .zip for you to try yourself.
the fnLMS_GetNumDevices function should response with ‘0’. the TestMode function doesn’t respond with anything, but it does functionally work. I have been told and have watched videos that running python inside of MATLAB works the same, but I am starting to question my presumptions. 🙁 Any and all help would be very much appreciated!!
I am using MATLAB 2022A I am using Python inside of MATLAB to load a DLL so I can use its functionality. I have tried almost every combination of inputs to try and make this MATLAB-Python combo work, but I have been unsuccessful. I know my DLL is good because I have used it using solely python and I have also gotten it working in MATLAB using a different set of commands, but I really want to use the MATLAB/Python combo.
Below is what I am trying to do
%% Using Python
ctypes = py.importlib.import_module(‘ctypes’);
vnx = ctypes.cdll.LoadLibrary(‘file path where dll and header files are stored vnx_fmsynth.dll’);
%% Calling these fx’s don’t work!
vnx.fnLMS_SetTestMode(0)
vnx.fnLMS_GetNumDevices()
I can assure fnLMS_SetTestMode and fnLMS_GetNumDevices, are methods within the DLL but python-matlab does not want to recognize them. I have tried over 100 combinations of trying to get the DLL to function, but I simply cannot figure out the correct syntax. When I run essentially the same lines in python however, it does work, so I am obviously doing something wrong inside of matlab.
Let me show you what does work in MATLAB with out using python.. (this does require you have a C-code compiler installed on your PC).
%% Load Libraries
cd(‘file path where dll and header files are stored’)
libName=’vnx_fmsynth’;
loadlibrary([libName,’.dll’],’vnx_LMS_api.h’)
libfunc= libfunctions(‘vnx_fmsynth’)
%% tab complete for the lazy
for i=1:length(libfunc)
libF.(libfunc{i})=libfunc{i}; % this way the auto complete from the structure’s field is the same as the library name
end
%% Calling these fx’s work!
calllib(libName, ‘fnLMS_SetTestMode’,0)
devNum=calllib(libName,libF.fnLMS_GetNumDevices)
I have included the files in .zip for you to try yourself.
the fnLMS_GetNumDevices function should response with ‘0’. the TestMode function doesn’t respond with anything, but it does functionally work. I have been told and have watched videos that running python inside of MATLAB works the same, but I am starting to question my presumptions. 🙁 Any and all help would be very much appreciated!!
I am using MATLAB 2022A ctype, dll, python, calllib, loadlibrary MATLAB Answers — New Questions
How to close autosar updater report with programming script?
hello guys,i update my autosar model by updateModel(ar,modelName).At the end of update process, a updater report will be opened. I want to close this report by m-scripts.It will be generous of you to provide me api name to complete this function.
Best regardhello guys,i update my autosar model by updateModel(ar,modelName).At the end of update process, a updater report will be opened. I want to close this report by m-scripts.It will be generous of you to provide me api name to complete this function.
Best regard hello guys,i update my autosar model by updateModel(ar,modelName).At the end of update process, a updater report will be opened. I want to close this report by m-scripts.It will be generous of you to provide me api name to complete this function.
Best regard report, autosar MATLAB Answers — New Questions
How do I Copy or Import a figure from MATLAB into Word document
Dear Support,
How do I copy or Import a figure (q-q plot graph) from MATLAB into Word document.
Thank you.Dear Support,
How do I copy or Import a figure (q-q plot graph) from MATLAB into Word document.
Thank you. Dear Support,
How do I copy or Import a figure (q-q plot graph) from MATLAB into Word document.
Thank you. how copy figuree into word document, word, activex, exportgraphics MATLAB Answers — New Questions
What Does Access Expire means in Matlab Fundamental
Hello, I completed my Matlab Fundamental and claimed the Badge Too . So after doing all test i noticed that it says Access expire in 2026 What does it means will my certificate will be invalid after 2026/ Will my certificate will be removed from the server?Hello, I completed my Matlab Fundamental and claimed the Badge Too . So after doing all test i noticed that it says Access expire in 2026 What does it means will my certificate will be invalid after 2026/ Will my certificate will be removed from the server? Hello, I completed my Matlab Fundamental and claimed the Badge Too . So after doing all test i noticed that it says Access expire in 2026 What does it means will my certificate will be invalid after 2026/ Will my certificate will be removed from the server? #matlab, #matlab_ fundamentals, certificate MATLAB Answers — New Questions
Intel P +E or AMD for large (2000) Monte Carlo simulations
I’m about to build a new pc with running large Monte Carlo simulation in mind. I know that matlab doesn’t benefit from threading. Am I better off with an Intel 14700k 20core (8P+12E) cpu, or an AMD 7950x 16core cpu (16P) cpu.
I’m concerned that the intel chip E cores can’t perform equally well as the P cores, so that different Monte Carlo runs won’t finish about the same time.
On the other hand, by running bench(0), I see that AMD chips are really bad at linear algebra, which is another concern to me.
A related q&a to this post
https://www.mathworks.com/matlabcentral/answers/2062522-how-does-parallel-computing-toolbox-handle-performance-and-efficiency-core-usageI’m about to build a new pc with running large Monte Carlo simulation in mind. I know that matlab doesn’t benefit from threading. Am I better off with an Intel 14700k 20core (8P+12E) cpu, or an AMD 7950x 16core cpu (16P) cpu.
I’m concerned that the intel chip E cores can’t perform equally well as the P cores, so that different Monte Carlo runs won’t finish about the same time.
On the other hand, by running bench(0), I see that AMD chips are really bad at linear algebra, which is another concern to me.
A related q&a to this post
https://www.mathworks.com/matlabcentral/answers/2062522-how-does-parallel-computing-toolbox-handle-performance-and-efficiency-core-usage I’m about to build a new pc with running large Monte Carlo simulation in mind. I know that matlab doesn’t benefit from threading. Am I better off with an Intel 14700k 20core (8P+12E) cpu, or an AMD 7950x 16core cpu (16P) cpu.
I’m concerned that the intel chip E cores can’t perform equally well as the P cores, so that different Monte Carlo runs won’t finish about the same time.
On the other hand, by running bench(0), I see that AMD chips are really bad at linear algebra, which is another concern to me.
A related q&a to this post
https://www.mathworks.com/matlabcentral/answers/2062522-how-does-parallel-computing-toolbox-handle-performance-and-efficiency-core-usage cpu, hardware setup, parallel computing, linear algebra, monte carlo MATLAB Answers — New Questions
Excel colour formatting based off value
Hey, I have a 10 point scale (1,2,3,4,5,6,7,8,9,10) and each number has a set colour attacthed to it. I then have names on the left and for example, uniform and behaviour on the top row, so each week i update each persons scale based on the 10 point system. However I need the total value of each topic per person. Like (green, green, yellow, red, orange) should equal 10+10+5+1+3=28/50. I am wanting to make it so that i can just change the number within the cell and have the colour change accordingly to the value (and also hide the text (number)) in the mean time.
Hey, I have a 10 point scale (1,2,3,4,5,6,7,8,9,10) and each number has a set colour attacthed to it. I then have names on the left and for example, uniform and behaviour on the top row, so each week i update each persons scale based on the 10 point system. However I need the total value of each topic per person. Like (green, green, yellow, red, orange) should equal 10+10+5+1+3=28/50. I am wanting to make it so that i can just change the number within the cell and have the colour change accordingly to the value (and also hide the text (number)) in the mean time. Read More
How to use the Automated Driving Toolbox to render car models in Unrealengine
A scenario was created using the Automated Driving Toolbox. It was confirmed that the vehicle moved according to the scenario in UnrealEngine 4.27.
Next, the car created in Blender was imported into UnrealEngine. Next, uasset was added to the "type" parameter of the Simulation 3D Vehicle with Ground Following block, but an error occurred and it could not be executed.
・The uasset was set to a static mesh
・The path of the uasset was the path that was obtained by copying the mesh reference in the UnrealEngine content browser (/Game/Alphard/Alphard.Alphard)
UnrealEngine errormessage
LoginId:56f3086d4e90220396b1f8a834dbef9b
EpicAccountId:8813ae5e8cfa455c88081ad3cf2b70ef
Assertion failed: VehMesh != nullptr [File:C:/TEMP/Bsim3d_2357499_7508/home/Desktop/SP/plg/MathWorksSimulation/HostProject/Plugins/MathWorksSimulation/Source/MathWorksSimulation/Private/Sim3dVeh.cpp] [Line: 254] Failed to load /Game/Alphard/Alphard1.Alphard1. Please specify a valid mesh path.
UE4Editor_Core
UE4Editor_Core
UE4Editor_MathWorksSimulation!DispatchCheckVerify<void,<lambda_a44834317377756d5b8114aa20be44b3> >() [C:Program FilesEpic GamesUE_4.27EngineSourceRuntimeCorePublicMiscAssertionMacros.h:164]
UE4Editor_MathWorksSimulation!ASim3dVeh::ConfigureDefaultMesh() [C:TEMPBsim3d_2357499_7508homeDesktopSPplgMathWorksSimulationHostProjectPluginsMathWorksSimulationSourceMathWorksSimulationPrivateSim3dVeh.cpp:254]
UE4Editor_MathWorksSimulation!ASim3dPassVeh::Sim3dSetup() [C:TEMPBsim3d_2357499_7508homeDesktopSPplgMathWorksSimulationHostProjectPluginsMathWorksSimulationSourceMathWorksSimulationPrivateSim3dPassVeh.cpp:109]
UE4Editor_MathWorksSimulation!ASim3dActor::BeginPlay() [C:TEMPBsim3d_2357499_7508homeDesktopSPplgMathWorksSimulationHostProjectPluginsMathWorksSimulationSourceMathWorksSimulationPrivateSim3dActor.cpp:153]
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
kernel32
ntdllA scenario was created using the Automated Driving Toolbox. It was confirmed that the vehicle moved according to the scenario in UnrealEngine 4.27.
Next, the car created in Blender was imported into UnrealEngine. Next, uasset was added to the "type" parameter of the Simulation 3D Vehicle with Ground Following block, but an error occurred and it could not be executed.
・The uasset was set to a static mesh
・The path of the uasset was the path that was obtained by copying the mesh reference in the UnrealEngine content browser (/Game/Alphard/Alphard.Alphard)
UnrealEngine errormessage
LoginId:56f3086d4e90220396b1f8a834dbef9b
EpicAccountId:8813ae5e8cfa455c88081ad3cf2b70ef
Assertion failed: VehMesh != nullptr [File:C:/TEMP/Bsim3d_2357499_7508/home/Desktop/SP/plg/MathWorksSimulation/HostProject/Plugins/MathWorksSimulation/Source/MathWorksSimulation/Private/Sim3dVeh.cpp] [Line: 254] Failed to load /Game/Alphard/Alphard1.Alphard1. Please specify a valid mesh path.
UE4Editor_Core
UE4Editor_Core
UE4Editor_MathWorksSimulation!DispatchCheckVerify<void,<lambda_a44834317377756d5b8114aa20be44b3> >() [C:Program FilesEpic GamesUE_4.27EngineSourceRuntimeCorePublicMiscAssertionMacros.h:164]
UE4Editor_MathWorksSimulation!ASim3dVeh::ConfigureDefaultMesh() [C:TEMPBsim3d_2357499_7508homeDesktopSPplgMathWorksSimulationHostProjectPluginsMathWorksSimulationSourceMathWorksSimulationPrivateSim3dVeh.cpp:254]
UE4Editor_MathWorksSimulation!ASim3dPassVeh::Sim3dSetup() [C:TEMPBsim3d_2357499_7508homeDesktopSPplgMathWorksSimulationHostProjectPluginsMathWorksSimulationSourceMathWorksSimulationPrivateSim3dPassVeh.cpp:109]
UE4Editor_MathWorksSimulation!ASim3dActor::BeginPlay() [C:TEMPBsim3d_2357499_7508homeDesktopSPplgMathWorksSimulationHostProjectPluginsMathWorksSimulationSourceMathWorksSimulationPrivateSim3dActor.cpp:153]
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
kernel32
ntdll A scenario was created using the Automated Driving Toolbox. It was confirmed that the vehicle moved according to the scenario in UnrealEngine 4.27.
Next, the car created in Blender was imported into UnrealEngine. Next, uasset was added to the "type" parameter of the Simulation 3D Vehicle with Ground Following block, but an error occurred and it could not be executed.
・The uasset was set to a static mesh
・The path of the uasset was the path that was obtained by copying the mesh reference in the UnrealEngine content browser (/Game/Alphard/Alphard.Alphard)
UnrealEngine errormessage
LoginId:56f3086d4e90220396b1f8a834dbef9b
EpicAccountId:8813ae5e8cfa455c88081ad3cf2b70ef
Assertion failed: VehMesh != nullptr [File:C:/TEMP/Bsim3d_2357499_7508/home/Desktop/SP/plg/MathWorksSimulation/HostProject/Plugins/MathWorksSimulation/Source/MathWorksSimulation/Private/Sim3dVeh.cpp] [Line: 254] Failed to load /Game/Alphard/Alphard1.Alphard1. Please specify a valid mesh path.
UE4Editor_Core
UE4Editor_Core
UE4Editor_MathWorksSimulation!DispatchCheckVerify<void,<lambda_a44834317377756d5b8114aa20be44b3> >() [C:Program FilesEpic GamesUE_4.27EngineSourceRuntimeCorePublicMiscAssertionMacros.h:164]
UE4Editor_MathWorksSimulation!ASim3dVeh::ConfigureDefaultMesh() [C:TEMPBsim3d_2357499_7508homeDesktopSPplgMathWorksSimulationHostProjectPluginsMathWorksSimulationSourceMathWorksSimulationPrivateSim3dVeh.cpp:254]
UE4Editor_MathWorksSimulation!ASim3dPassVeh::Sim3dSetup() [C:TEMPBsim3d_2357499_7508homeDesktopSPplgMathWorksSimulationHostProjectPluginsMathWorksSimulationSourceMathWorksSimulationPrivateSim3dPassVeh.cpp:109]
UE4Editor_MathWorksSimulation!ASim3dActor::BeginPlay() [C:TEMPBsim3d_2357499_7508homeDesktopSPplgMathWorksSimulationHostProjectPluginsMathWorksSimulationSourceMathWorksSimulationPrivateSim3dActor.cpp:153]
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
kernel32
ntdll automated driving toolbox, unrealengine, simulink, simulation3dvehiclewithgroundfollowing MATLAB Answers — New Questions
Exporting C++code to Visual Studio using the Simulink model yields incorrect results
I have a Simulink model that includes the Three Phase Breaker module, Three Phase Source module, and Switch module. After exporting C++code using Simulink coder and running it in visual studio 2022, the results are inconsistent with those running in Simulink.The Matlab version used is 2023a.I have a Simulink model that includes the Three Phase Breaker module, Three Phase Source module, and Switch module. After exporting C++code using Simulink coder and running it in visual studio 2022, the results are inconsistent with those running in Simulink.The Matlab version used is 2023a. I have a Simulink model that includes the Three Phase Breaker module, Three Phase Source module, and Switch module. After exporting C++code using Simulink coder and running it in visual studio 2022, the results are inconsistent with those running in Simulink.The Matlab version used is 2023a. simulink, c++, visual studio MATLAB Answers — New Questions
Cannot leave insider program, never signed up
Hello, I am having an issue where I want to leave the insider program as I never signed up for it, but when I click leave program, the window continues loading and does not provide any way for me to leave.
I am currently unable to update my PC and Microsoft support has let me know that they cannot help me because I am in the insider program. I never signed up for this and I want out so that I can fix my PC.
Hello, I am having an issue where I want to leave the insider program as I never signed up for it, but when I click leave program, the window continues loading and does not provide any way for me to leave. I am currently unable to update my PC and Microsoft support has let me know that they cannot help me because I am in the insider program. I never signed up for this and I want out so that I can fix my PC. Read More
Any way to force a higher desktop resolution then active signal?
You can see from the screenshot that the display duplicated. Anyone knows how to achieve this in extend mode?
You can see from the screenshot that the display duplicated. Anyone knows how to achieve this in extend mode? Read More
How to load .mat file into base workspace using app designer
I want to run my model in app desinger.
Therefore, all parameters from the .mat file are required to run the model.
How to load all parameters from mat file into base workspace?I want to run my model in app desinger.
Therefore, all parameters from the .mat file are required to run the model.
How to load all parameters from mat file into base workspace? I want to run my model in app desinger.
Therefore, all parameters from the .mat file are required to run the model.
How to load all parameters from mat file into base workspace? appdesigner MATLAB Answers — New Questions
How to implement constraints (conditions) to the estimation of parameters by fitting?
Hi to everyone!
How to implement in the Simbiology interface so that the estimated parameters in a fit satisfy a given condition? For example, estimate by a fit the values of the kinetic constants k1 and k-1 for a serie of experimental data, which satisfy the value of the equilibrium constant Keq (Keq= k1/k-1) within a given interval, such as K= 10±2.
Thank you in advance!Hi to everyone!
How to implement in the Simbiology interface so that the estimated parameters in a fit satisfy a given condition? For example, estimate by a fit the values of the kinetic constants k1 and k-1 for a serie of experimental data, which satisfy the value of the equilibrium constant Keq (Keq= k1/k-1) within a given interval, such as K= 10±2.
Thank you in advance! Hi to everyone!
How to implement in the Simbiology interface so that the estimated parameters in a fit satisfy a given condition? For example, estimate by a fit the values of the kinetic constants k1 and k-1 for a serie of experimental data, which satisfy the value of the equilibrium constant Keq (Keq= k1/k-1) within a given interval, such as K= 10±2.
Thank you in advance! simbiology MATLAB Answers — New Questions
Readmatrix reading csv files incorrectly by replacing values with NaN and adding a third column
Hi all,
I have 10 ".csv" files which I am importing into MATLAB using the readmatrix function. All of these files are identical as follows:
Rows: 1000001 – First row has headers (Time [s], Volts [V]))
Columns: 2
All but two files are not being imported correctly. I have tried opening them in text editors to verify the comma delimiter and it is correct. I do not know what the issue is. For these two files, MATLAB reads the second (Volts) column as NaN and adds a third NaN column to it.
Kindly please help.
The line of code I am using is: variable_x = readmatrix(‘filename’);
A short excript is as follows:
Important to note that I have also tried the ‘range’ and ‘delimiter’ options explicitly to no avail. Might be a bug. I am using R2023bHi all,
I have 10 ".csv" files which I am importing into MATLAB using the readmatrix function. All of these files are identical as follows:
Rows: 1000001 – First row has headers (Time [s], Volts [V]))
Columns: 2
All but two files are not being imported correctly. I have tried opening them in text editors to verify the comma delimiter and it is correct. I do not know what the issue is. For these two files, MATLAB reads the second (Volts) column as NaN and adds a third NaN column to it.
Kindly please help.
The line of code I am using is: variable_x = readmatrix(‘filename’);
A short excript is as follows:
Important to note that I have also tried the ‘range’ and ‘delimiter’ options explicitly to no avail. Might be a bug. I am using R2023b Hi all,
I have 10 ".csv" files which I am importing into MATLAB using the readmatrix function. All of these files are identical as follows:
Rows: 1000001 – First row has headers (Time [s], Volts [V]))
Columns: 2
All but two files are not being imported correctly. I have tried opening them in text editors to verify the comma delimiter and it is correct. I do not know what the issue is. For these two files, MATLAB reads the second (Volts) column as NaN and adds a third NaN column to it.
Kindly please help.
The line of code I am using is: variable_x = readmatrix(‘filename’);
A short excript is as follows:
Important to note that I have also tried the ‘range’ and ‘delimiter’ options explicitly to no avail. Might be a bug. I am using R2023b readmatrix, csv, nan MATLAB Answers — New Questions
Error in demodulation QAM-16 signal
% This code, after demodulation, produces a sequence of 4 values, although the number of values should be equal to the modulation factor M. What could be the problem?
clc
close all
clear all
M = 16;
L=10000;
T=10;
W=43; %SNR
bits1 = randi([0 M-1], 1, L);
bits2 = randi([0 3], 1, L/T);
mod1 = qammod(bits1, M,’UnitAveragePower’, true);
% scatterplot(mod1)
mod2 = qammod(bits2, 4, ‘UnitAveragePower’,true);
% scatterplot(mod2)
for i = 1:length(bits2)
sym(i,:)=[mod1((i-1)*T+1:i*T) mod2(i)];
end
f=0;
for k=1:L/T
for j=1:T+1
f=f+1;
symbols(f)=sym(k,j);
end
end
% scatterplot(symbols)
% symbols = awgn(symbols,W,"measured");
pnoise = comm.PhaseNoise(‘Level’,[-70 -104 -110],’FrequencyOffset’,[1e4 1e5 2e5], ‘SampleRate’, 28e6);
symbols2 = pnoise([zeros(1e5,1);symbols’]);
% symbols2 = pnoise(symbols);
fc = 1e6; % Carrier frequency in Hz
fs = 28e6; % Sample rate in Hz.
phNzLevel = [-70 -104 -110]; % in dBc/Hz
phNzFreqOff = [1e4 1e5 2e5]; % in Hz
Nspf = 6e6; % Number of Samples per frame
freqSpan = 400e3; % in Hz, for spectrum computation
sinewave = dsp.SineWave( …
Amplitude=1, …
Frequency=fc, …
SampleRate=fs, …
SamplesPerFrame=Nspf, …
ComplexOutput=true);
pnoise = comm.PhaseNoise( …
Level=phNzLevel, …
FrequencyOffset=phNzFreqOff, …
SampleRate=fs);
sascopeRBW100 = spectrumAnalyzer( …
SampleRate=fs, …
Method="welch", …
FrequencySpan="Span and center frequency", …
CenterFrequency=fc, …
Span=freqSpan, …
RBWSource="Property", …
RBW=100, …
SpectrumType="Power density", …
SpectralAverages=10, …
SpectrumUnits="dBW", …
YLimits=[-150 10], …
Title="Resolution Bandwidth 100 Hz", …
ChannelNames={‘signal’,’signal with phase noise’}, …
Position=[79 147 605 374]);
x = sinewave();
y = pnoise(x);
sascopeRBW100(x,y)
symbols2 = symbols2(1e5+1:end);
prim(1,:)=symbols2(1:T);
for i = 1:length(bits2)-1
prim(i+1,:)=symbols2(i*T+i+1:i*T+i+T);
end
for b = 1:length(mod2)
qam4(b)=symbols2((T+1)*b);
end
h=0;
for u=1:L/T
for l=1:T
h=h+1;
priem(h)=prim(u,l);
end
end
for g = 1:L/T
phase_error(g) = angle(qam4(g) / mod2(g));
compensated4(g) = qam4(g) .* exp(-1i * phase_error(g));
end
for v = 1:L/T
phase_errorM((v-1)*T+1:v*T)=phase_error(v);
end
for f = 1:L
compensatedM(f) = priem(f) .* exp(-1i*phase_errorM(f));
end
demod=qamdemod(compensatedM, M, ‘bin’,’OutputType’,’bit’);
% scatterplot(qam4)
% scatterplot(symbols2)
% scatterplot(compensatedM)
[number,ratio]=biterr(bits1,demod);
evm = lteEVM(demod,bits1);
figure(‘Position’,[200 200 1080 540])
subplot(1,2,1)
scatter(real(symbols2),imag(symbols2),300,".")
subplot(1,2,2)
scatter(real(compensatedM),imag(compensatedM),300,".")% This code, after demodulation, produces a sequence of 4 values, although the number of values should be equal to the modulation factor M. What could be the problem?
clc
close all
clear all
M = 16;
L=10000;
T=10;
W=43; %SNR
bits1 = randi([0 M-1], 1, L);
bits2 = randi([0 3], 1, L/T);
mod1 = qammod(bits1, M,’UnitAveragePower’, true);
% scatterplot(mod1)
mod2 = qammod(bits2, 4, ‘UnitAveragePower’,true);
% scatterplot(mod2)
for i = 1:length(bits2)
sym(i,:)=[mod1((i-1)*T+1:i*T) mod2(i)];
end
f=0;
for k=1:L/T
for j=1:T+1
f=f+1;
symbols(f)=sym(k,j);
end
end
% scatterplot(symbols)
% symbols = awgn(symbols,W,"measured");
pnoise = comm.PhaseNoise(‘Level’,[-70 -104 -110],’FrequencyOffset’,[1e4 1e5 2e5], ‘SampleRate’, 28e6);
symbols2 = pnoise([zeros(1e5,1);symbols’]);
% symbols2 = pnoise(symbols);
fc = 1e6; % Carrier frequency in Hz
fs = 28e6; % Sample rate in Hz.
phNzLevel = [-70 -104 -110]; % in dBc/Hz
phNzFreqOff = [1e4 1e5 2e5]; % in Hz
Nspf = 6e6; % Number of Samples per frame
freqSpan = 400e3; % in Hz, for spectrum computation
sinewave = dsp.SineWave( …
Amplitude=1, …
Frequency=fc, …
SampleRate=fs, …
SamplesPerFrame=Nspf, …
ComplexOutput=true);
pnoise = comm.PhaseNoise( …
Level=phNzLevel, …
FrequencyOffset=phNzFreqOff, …
SampleRate=fs);
sascopeRBW100 = spectrumAnalyzer( …
SampleRate=fs, …
Method="welch", …
FrequencySpan="Span and center frequency", …
CenterFrequency=fc, …
Span=freqSpan, …
RBWSource="Property", …
RBW=100, …
SpectrumType="Power density", …
SpectralAverages=10, …
SpectrumUnits="dBW", …
YLimits=[-150 10], …
Title="Resolution Bandwidth 100 Hz", …
ChannelNames={‘signal’,’signal with phase noise’}, …
Position=[79 147 605 374]);
x = sinewave();
y = pnoise(x);
sascopeRBW100(x,y)
symbols2 = symbols2(1e5+1:end);
prim(1,:)=symbols2(1:T);
for i = 1:length(bits2)-1
prim(i+1,:)=symbols2(i*T+i+1:i*T+i+T);
end
for b = 1:length(mod2)
qam4(b)=symbols2((T+1)*b);
end
h=0;
for u=1:L/T
for l=1:T
h=h+1;
priem(h)=prim(u,l);
end
end
for g = 1:L/T
phase_error(g) = angle(qam4(g) / mod2(g));
compensated4(g) = qam4(g) .* exp(-1i * phase_error(g));
end
for v = 1:L/T
phase_errorM((v-1)*T+1:v*T)=phase_error(v);
end
for f = 1:L
compensatedM(f) = priem(f) .* exp(-1i*phase_errorM(f));
end
demod=qamdemod(compensatedM, M, ‘bin’,’OutputType’,’bit’);
% scatterplot(qam4)
% scatterplot(symbols2)
% scatterplot(compensatedM)
[number,ratio]=biterr(bits1,demod);
evm = lteEVM(demod,bits1);
figure(‘Position’,[200 200 1080 540])
subplot(1,2,1)
scatter(real(symbols2),imag(symbols2),300,".")
subplot(1,2,2)
scatter(real(compensatedM),imag(compensatedM),300,".") % This code, after demodulation, produces a sequence of 4 values, although the number of values should be equal to the modulation factor M. What could be the problem?
clc
close all
clear all
M = 16;
L=10000;
T=10;
W=43; %SNR
bits1 = randi([0 M-1], 1, L);
bits2 = randi([0 3], 1, L/T);
mod1 = qammod(bits1, M,’UnitAveragePower’, true);
% scatterplot(mod1)
mod2 = qammod(bits2, 4, ‘UnitAveragePower’,true);
% scatterplot(mod2)
for i = 1:length(bits2)
sym(i,:)=[mod1((i-1)*T+1:i*T) mod2(i)];
end
f=0;
for k=1:L/T
for j=1:T+1
f=f+1;
symbols(f)=sym(k,j);
end
end
% scatterplot(symbols)
% symbols = awgn(symbols,W,"measured");
pnoise = comm.PhaseNoise(‘Level’,[-70 -104 -110],’FrequencyOffset’,[1e4 1e5 2e5], ‘SampleRate’, 28e6);
symbols2 = pnoise([zeros(1e5,1);symbols’]);
% symbols2 = pnoise(symbols);
fc = 1e6; % Carrier frequency in Hz
fs = 28e6; % Sample rate in Hz.
phNzLevel = [-70 -104 -110]; % in dBc/Hz
phNzFreqOff = [1e4 1e5 2e5]; % in Hz
Nspf = 6e6; % Number of Samples per frame
freqSpan = 400e3; % in Hz, for spectrum computation
sinewave = dsp.SineWave( …
Amplitude=1, …
Frequency=fc, …
SampleRate=fs, …
SamplesPerFrame=Nspf, …
ComplexOutput=true);
pnoise = comm.PhaseNoise( …
Level=phNzLevel, …
FrequencyOffset=phNzFreqOff, …
SampleRate=fs);
sascopeRBW100 = spectrumAnalyzer( …
SampleRate=fs, …
Method="welch", …
FrequencySpan="Span and center frequency", …
CenterFrequency=fc, …
Span=freqSpan, …
RBWSource="Property", …
RBW=100, …
SpectrumType="Power density", …
SpectralAverages=10, …
SpectrumUnits="dBW", …
YLimits=[-150 10], …
Title="Resolution Bandwidth 100 Hz", …
ChannelNames={‘signal’,’signal with phase noise’}, …
Position=[79 147 605 374]);
x = sinewave();
y = pnoise(x);
sascopeRBW100(x,y)
symbols2 = symbols2(1e5+1:end);
prim(1,:)=symbols2(1:T);
for i = 1:length(bits2)-1
prim(i+1,:)=symbols2(i*T+i+1:i*T+i+T);
end
for b = 1:length(mod2)
qam4(b)=symbols2((T+1)*b);
end
h=0;
for u=1:L/T
for l=1:T
h=h+1;
priem(h)=prim(u,l);
end
end
for g = 1:L/T
phase_error(g) = angle(qam4(g) / mod2(g));
compensated4(g) = qam4(g) .* exp(-1i * phase_error(g));
end
for v = 1:L/T
phase_errorM((v-1)*T+1:v*T)=phase_error(v);
end
for f = 1:L
compensatedM(f) = priem(f) .* exp(-1i*phase_errorM(f));
end
demod=qamdemod(compensatedM, M, ‘bin’,’OutputType’,’bit’);
% scatterplot(qam4)
% scatterplot(symbols2)
% scatterplot(compensatedM)
[number,ratio]=biterr(bits1,demod);
evm = lteEVM(demod,bits1);
figure(‘Position’,[200 200 1080 540])
subplot(1,2,1)
scatter(real(symbols2),imag(symbols2),300,".")
subplot(1,2,2)
scatter(real(compensatedM),imag(compensatedM),300,".") qam16, demodulation, ber MATLAB Answers — New Questions
Sending HoloLens 2 video stream through Roboflow API
Hello everyone,
I’m currently working on a mixed reality project for the HoloLens 2, which involves the use of a computer vision model for the recognition of some shop-floor equipment and parts. My team has trained this model in Roboflow, using the data we’ve collected in a factory.
However, we’re not sure how to integrate this model to the HoloLens. We thought it could be a good idea to access the HoloLens’ video stream in order to send it to the CV model through the Roboflow API, and get the result back, in runtime. So we’re looking at Microsoft’s CV samples for the HoloLens 2, which includes a “StreamRecorder” sample. However, this sample saves the stream in a raw format, which would need to be converted before sending it to the CV model.
We’re actually not even sure if using this sample as a basis is the best way to do what we want, so we’re a bit lost at the moment. Has anyone here tried accessing the Roboflow API from a HoloLens 2? How would be the best way to go about it?
Thanks in advance.
Hello everyone, I’m currently working on a mixed reality project for the HoloLens 2, which involves the use of a computer vision model for the recognition of some shop-floor equipment and parts. My team has trained this model in Roboflow, using the data we’ve collected in a factory. However, we’re not sure how to integrate this model to the HoloLens. We thought it could be a good idea to access the HoloLens’ video stream in order to send it to the CV model through the Roboflow API, and get the result back, in runtime. So we’re looking at Microsoft’s CV samples for the HoloLens 2, which includes a “StreamRecorder” sample. However, this sample saves the stream in a raw format, which would need to be converted before sending it to the CV model. We’re actually not even sure if using this sample as a basis is the best way to do what we want, so we’re a bit lost at the moment. Has anyone here tried accessing the Roboflow API from a HoloLens 2? How would be the best way to go about it? Thanks in advance. Read More
Show a Plan as a Tab inside Teams Channel is no more working using Graph API, any advice?
I have this work flow which create a new Team Channel + create a new Planner Plan + show the Planner Plan as a tab inside the Team Channel. this was working well for around 6 months, but recently it stop working as expected.
Here is my workflow which uses Graph API:-
here is the “Body of the request” for showing the plan as a tab inside channel action:-
{
“displayName”: “@{outputs(‘Compose_-_Friendly_Planner_Name’)}”,
“email address removed for privacy reasons”: “https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/com.microsoft.teamspace.tab.planner”,
“configuration”: {
“entityId”: “@{body(‘Invoke_an_HTTP_request_-_Create_new_Channel’)?[‘id’]}”,
“contentUrl”: “https://tasks.teams.microsoft.com/teamsui/{tid}/Home/PlannerFrame?page=7&auth_pvr=OrgId&auth_upn={userPrincipalName}&groupId={groupId}&planId=@{variables(‘PlannerID’)}&channelId={channelId}&entityId={entityId}&tid={tid}&userObjectId={userObjectId}&subEntityId={subEntityId}&sessionId={sessionId}&theme={theme}&mkt={locale}&ringId={ringId}&PlannerRouteHint={tid}”,
“removeUrl”: “https://tasks.teams.microsoft.com/teamsui/{tid}/Home/PlannerFrame?page=13&auth_pvr=OrgId&auth_upn={userPrincipalName}&groupId={groupId}&planId=@{variables(‘PlannerID’)}&channelId={channelId}&entityId={entityId}&tid={tid}&userObjectId={userObjectId}&subEntityId={subEntityId}&sessionId={sessionId}&theme={theme}&mkt={locale}&ringId={ringId}&PlannerRouteHint={tid}”,
“websiteUrl”: “https://tasks.office.com/{tid}/Home/PlanViews/@{variables(‘PlannerID’)}?Type=PlanLink&Channel=TeamsTab”
}
}
Currently when i click on the new tab i will not get the new planner tasks, i will rather get “My Tasks”,as follow:-
previously i use to get the related Planner tasks as follow:-
any advice, why this is no loner working as it use to be?
Thanks
I have this work flow which create a new Team Channel + create a new Planner Plan + show the Planner Plan as a tab inside the Team Channel. this was working well for around 6 months, but recently it stop working as expected. Here is my workflow which uses Graph API:- here is the “Body of the request” for showing the plan as a tab inside channel action:-{
“displayName”: “@{outputs(‘Compose_-_Friendly_Planner_Name’)}”,
“email address removed for privacy reasons”: “https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/com.microsoft.teamspace.tab.planner”,
“configuration”: {
“entityId”: “@{body(‘Invoke_an_HTTP_request_-_Create_new_Channel’)?[‘id’]}”,
“contentUrl”: “https://tasks.teams.microsoft.com/teamsui/{tid}/Home/PlannerFrame?page=7&auth_pvr=OrgId&auth_upn={userPrincipalName}&groupId={groupId}&planId=@{variables(‘PlannerID’)}&channelId={channelId}&entityId={entityId}&tid={tid}&userObjectId={userObjectId}&subEntityId={subEntityId}&sessionId={sessionId}&theme={theme}&mkt={locale}&ringId={ringId}&PlannerRouteHint={tid}”,
“removeUrl”: “https://tasks.teams.microsoft.com/teamsui/{tid}/Home/PlannerFrame?page=13&auth_pvr=OrgId&auth_upn={userPrincipalName}&groupId={groupId}&planId=@{variables(‘PlannerID’)}&channelId={channelId}&entityId={entityId}&tid={tid}&userObjectId={userObjectId}&subEntityId={subEntityId}&sessionId={sessionId}&theme={theme}&mkt={locale}&ringId={ringId}&PlannerRouteHint={tid}”,
“websiteUrl”: “https://tasks.office.com/{tid}/Home/PlanViews/@{variables(‘PlannerID’)}?Type=PlanLink&Channel=TeamsTab”
}
} Currently when i click on the new tab i will not get the new planner tasks, i will rather get “My Tasks”,as follow:- previously i use to get the related Planner tasks as follow:- any advice, why this is no loner working as it use to be? Thanks Read More
How we can filter all the tasks from all the Plans based on the assgined user
We have a Teams which contain around 40++ planner plans. The managers are facing troubles when they want to see all the tasks from all the planner plans assigned to certain user. Currently to do this, they need to go to each individual plan and do the filter, is there any built-in or using sharepoint web parts to be able to filter all the tasks from different plans based on the assigned to user?
Thanks
We have a Teams which contain around 40++ planner plans. The managers are facing troubles when they want to see all the tasks from all the planner plans assigned to certain user. Currently to do this, they need to go to each individual plan and do the filter, is there any built-in or using sharepoint web parts to be able to filter all the tasks from different plans based on the assigned to user? Thanks Read More
Web part to filter planner plans based on the Assigned To user?
We have a Teams which contain around 40++ planner plans. The managers are facing troubles when they want to see all the tasks from all the planner plans assigned to certain user. Currently to do this, they need to go to each individual plan and do the filter, is there any built-in or using sharepoint web parts to be able to filter all the tasks from different plans based on the assigned to user?
can we for example benefit from modern search web part to achieve this? or any other web parts?
We have a Teams which contain around 40++ planner plans. The managers are facing troubles when they want to see all the tasks from all the planner plans assigned to certain user. Currently to do this, they need to go to each individual plan and do the filter, is there any built-in or using sharepoint web parts to be able to filter all the tasks from different plans based on the assigned to user? can we for example benefit from modern search web part to achieve this? or any other web parts? Read More
Forgotten Password to unlock Excel Spreadsheet
Help Please!
We must have typed in the wrong password (twice??) to lock an Excel spreadsheet.
How do I get back in???
It must have been mis-typed twice, but we can’t recover it now, and have tried all variations of the regular password. 🙁
THANK YOU!
Help Please!We must have typed in the wrong password (twice??) to lock an Excel spreadsheet.How do I get back in???It must have been mis-typed twice, but we can’t recover it now, and have tried all variations of the regular password. 🙁 THANK YOU! Read More
Updates from the 162.3 release of SqlPackage and the DacFx ecosystem
The quarterly release cadence for SqlPackage and DacFx continues with the 162.3.563 release on June 6, 2024. The most notable change in this version is the preview release of a target platform for Fabric mirrored SQL databases. The 162.3.563 release also includes fixes related to script parsing (ScriptDOM) and deployments. Read more about the fixes in the SqlPackage release notes.
Target platforms in SQL projects
SQL projects are a logical framework around your database code and this sets the foundation for two development capabilities:
Build-time validation of references between objects and the syntax against a specific version of SQL
Deployment of the build artifact to new or existing databases
When a SQL project is built, the relationships between objects contained in the project files are validated. For example, the columns or tables referenced in a view definition must exist in the SQL project.
Additionally, a SQL project contains a property called the “target platform” in the DSP element of the .sqlproj file. This setting is used during the build process to validate that the functions and T-SQL syntax is supported in the specified version of SQL. For example, the JSON functions added in SQL Server 2022 cannot be used in a SQL project set to the SQL Server 2017 (Sql140DatabaseSchemaProvider) target platform.
Mirroring your SQL database to Microsoft Fabric provides a streamlined experience to avoid complex ETL (Extract Transform Load) and integrate existing your Azure SQL Database estate with the rest of your data in Microsoft Fabric. In the new target platform for “Fabric mirrored SQL database (preview)” (SqlDbFabricDatabaseSchemaProvider) added in DacFx 162.3.563, the tables in the SQL project are validated for compatibility with mirroring to Microsoft Fabric. Having a target platform for a mirrored SQL database means that you can develop your Azure SQL application with confidence that the application’s data will be available for analytics with minimal additional effort.
The target platform is available immediately for use with SDK-style projects with the Microsoft.Build.Sql project SDK version 0.1.19-preview. Your existing SDK-style SQL projects can be moved from the Azure SQL Database target platform to the Fabric mirrored SQL database (preview) target platform by updating the version of the Sdk to 0.1.19-preview (line 3 below) and the DSP (target platform) to SqlDbFabricDatabaseSchemaProvider (line 7 below). For a walkthrough of mirroring your Azure SQL Database to Microsoft Fabric, check out the tutorial.
The “Fabric mirrored SQL database (preview)” target platform will be available directly in the SQL projects extension for VS Code and Azure Data Studio as well as Visual Studio in the upcoming months. In the meantime, SQL projects can be built and deployed with the new target platform from the command line with dotnet build and SqlPackage.
SqlPackage and SQL projects on arm64
GitHub recently announced arm64 actions runners with the initial availability in public preview of images built on Ubuntu 22.04. Whether you’re using the recently launched arm64 runners, an Apple M-series workstation, or one of the arm-powered Surface devices the base requirements for working with SqlPackage and SDK-style SQL projects remain the same – the .NET SDK must be installed. The current Ubuntu 22.04 arm64 preview image includes the .NET SDK.
With the .NET SDK installed in an arm64 environment such as the GitHub actions arm64 runners, your SQL development workflow can leverage the same commands as x64 environments. Dotnet build is still used to create a dacpac from a SQL project, but you may need to install SqlPackage as a dotnet tool to perform additional actions:
dotnet install -g microsoft.sqlpackage
Once SqlPackage is installed it can be used as usual, including deploying (publish) a dacpac to update the schema a database or to extract the objects in a database out to files.
# publish
sqlpackage /Action:Publish /SourceFile:bin/Debug/AdventureWorks.dacpac /TargetConnectionString:<YourConnectionString>
# extract
sqlpackage /Action:Extract /SourceConnectionString:<YourConnectionString> /TargetFile:AdventureWorks /p:ExtractTarget=SchemaObjectType
For developers interested in continuing to use the original SQL projects in Visual Studio, we also note that SQL Server Data Tools (SSDT) has been released for Visual Studio on arm64.
.gitignore with SQL projects
You may recall about a year ago we introduced project templates for quickly starting a new SQL project from the command line. Earlier this year an option was added to the templates (-g) which includes a default gitignore file with a new SQL project. With a .gitignore file you can avoid accidentally checking cached binaries in the bin and obj folders into source control and minimize noise in your source control history.
Installing the SQL project templates and creating a new SQL project with the Fabric mirrored SQL database (preview) target platform and a gitignore file is completed with these two commands:
dotnet new install Microsoft.Build.Sql.Templates
dotnet new sqlproj -n “AdventureWorksLT” -tp “SqlDbFabric” -g
Ways to get involved
In early 2024, we added preview releases of SqlPackage to the dotnet tool feed, such that not only do you have early access to DacFx changes but you can directly test SqlPackage as well. Eagle-eyed readers will notice that the last preview release prior to the full release only differs by a single patch build. Get the quick instructions on installing and updating the preview releases in the SqlPackage documentation.
All are welcome to stop by the GitHub repository to provide feedback, whether it is bug reports, questions, or enhancement suggestions. Here are a few recent feature suggestions you might want to weigh in on:
Support for dotnet publish https://github.com/microsoft/DacFx/issues/447
Composite projects in schema comparison https://github.com/microsoft/DacFx/issues/437
Automatic skipping of Windows logins https://github.com/microsoft/DacFx/issues/426
Microsoft Tech Community – Latest Blogs –Read More