Category: News
Error using build after clibgen.generateLibraryDefinition runs as expected.
I’m attempting to follow a tutorial for interfacing with C++ libraries in MATLAB. The only major difference between my situation and the author’s is that I’m working on a windows machine, meaning that I run
> cl /c rectangle.cpp
> log /OUT:rectangle.lib rectangle.obj
to compile into a .obj file (rather than .o) and reformat it to .lib. Then, in the MATLAB environment, I run
>> headerFile = "C:pathtorectangle.h";
>> libFile = "C:pathtorectangle.lib";
>> libName = "rectangle";
>> clibgen.generateLibraryDefinition(headerFile, "Libraries", libFile, "PackageName", libName)
This runs without issue. The generated definerectangle.m looks as I expect, and the summary looks as follows:
>> summary(definerectangle)
MATLAB Interface to rectangle Library
Class clib.rectangle.Rectangle
Constructors:
clib.rectangle.Rectangle(double,double,double,double)
clib.rectangle.Rectangle(clib.rectangle.Rectangle)
Methods:
double Area()
No Properties defined
which seems right. However, when I attempt to build, I get the following result
>> build(definerectangle)
Building interface file ‘rectangleInterface.dll’ for clib interface ‘rectangle’.
Not enough input arguments.
Error in clibgen.internal.build>delAdditionalFiles (line 1001)
for ind = 1:length(cmdFilesList)
^^^^^^^^^^^^
Error in clibgen.internal.build (line 378)
delAdditionalFiles(outputDir, srcFileName, dataFileName, buildExecutable, sourceFilesObj, ”);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in clibgen.internal.buildHelper (line 104)
[status,cmdOut] = clibgen.internal.build(srcFile,cellstr(libraries),cellstr(srcFiles),cellstr(includePath),interfaceDir,obj.DefinedMacros,obj.UndefinedMacros, …
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in clibgen.LibraryDefinition/build (line 1664)
clibgen.internal.buildHelper(obj, obj.LibraryInterface, ”, directBuild);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I have checked the mex compiler configuration to see if that might be an issue, but it appears to match what I used to compile with cl.exe
>> mex -setup cpp
MEX configured to use ‘Microsoft Visual C++ 2022’ for C++ language compilation.
I’m at a loss for what this error could mean, so I would appreciate any help in interpreting it and getting this to work.I’m attempting to follow a tutorial for interfacing with C++ libraries in MATLAB. The only major difference between my situation and the author’s is that I’m working on a windows machine, meaning that I run
> cl /c rectangle.cpp
> log /OUT:rectangle.lib rectangle.obj
to compile into a .obj file (rather than .o) and reformat it to .lib. Then, in the MATLAB environment, I run
>> headerFile = "C:pathtorectangle.h";
>> libFile = "C:pathtorectangle.lib";
>> libName = "rectangle";
>> clibgen.generateLibraryDefinition(headerFile, "Libraries", libFile, "PackageName", libName)
This runs without issue. The generated definerectangle.m looks as I expect, and the summary looks as follows:
>> summary(definerectangle)
MATLAB Interface to rectangle Library
Class clib.rectangle.Rectangle
Constructors:
clib.rectangle.Rectangle(double,double,double,double)
clib.rectangle.Rectangle(clib.rectangle.Rectangle)
Methods:
double Area()
No Properties defined
which seems right. However, when I attempt to build, I get the following result
>> build(definerectangle)
Building interface file ‘rectangleInterface.dll’ for clib interface ‘rectangle’.
Not enough input arguments.
Error in clibgen.internal.build>delAdditionalFiles (line 1001)
for ind = 1:length(cmdFilesList)
^^^^^^^^^^^^
Error in clibgen.internal.build (line 378)
delAdditionalFiles(outputDir, srcFileName, dataFileName, buildExecutable, sourceFilesObj, ”);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in clibgen.internal.buildHelper (line 104)
[status,cmdOut] = clibgen.internal.build(srcFile,cellstr(libraries),cellstr(srcFiles),cellstr(includePath),interfaceDir,obj.DefinedMacros,obj.UndefinedMacros, …
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in clibgen.LibraryDefinition/build (line 1664)
clibgen.internal.buildHelper(obj, obj.LibraryInterface, ”, directBuild);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I have checked the mex compiler configuration to see if that might be an issue, but it appears to match what I used to compile with cl.exe
>> mex -setup cpp
MEX configured to use ‘Microsoft Visual C++ 2022’ for C++ language compilation.
I’m at a loss for what this error could mean, so I would appreciate any help in interpreting it and getting this to work. I’m attempting to follow a tutorial for interfacing with C++ libraries in MATLAB. The only major difference between my situation and the author’s is that I’m working on a windows machine, meaning that I run
> cl /c rectangle.cpp
> log /OUT:rectangle.lib rectangle.obj
to compile into a .obj file (rather than .o) and reformat it to .lib. Then, in the MATLAB environment, I run
>> headerFile = "C:pathtorectangle.h";
>> libFile = "C:pathtorectangle.lib";
>> libName = "rectangle";
>> clibgen.generateLibraryDefinition(headerFile, "Libraries", libFile, "PackageName", libName)
This runs without issue. The generated definerectangle.m looks as I expect, and the summary looks as follows:
>> summary(definerectangle)
MATLAB Interface to rectangle Library
Class clib.rectangle.Rectangle
Constructors:
clib.rectangle.Rectangle(double,double,double,double)
clib.rectangle.Rectangle(clib.rectangle.Rectangle)
Methods:
double Area()
No Properties defined
which seems right. However, when I attempt to build, I get the following result
>> build(definerectangle)
Building interface file ‘rectangleInterface.dll’ for clib interface ‘rectangle’.
Not enough input arguments.
Error in clibgen.internal.build>delAdditionalFiles (line 1001)
for ind = 1:length(cmdFilesList)
^^^^^^^^^^^^
Error in clibgen.internal.build (line 378)
delAdditionalFiles(outputDir, srcFileName, dataFileName, buildExecutable, sourceFilesObj, ”);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in clibgen.internal.buildHelper (line 104)
[status,cmdOut] = clibgen.internal.build(srcFile,cellstr(libraries),cellstr(srcFiles),cellstr(includePath),interfaceDir,obj.DefinedMacros,obj.UndefinedMacros, …
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in clibgen.LibraryDefinition/build (line 1664)
clibgen.internal.buildHelper(obj, obj.LibraryInterface, ”, directBuild);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I have checked the mex compiler configuration to see if that might be an issue, but it appears to match what I used to compile with cl.exe
>> mex -setup cpp
MEX configured to use ‘Microsoft Visual C++ 2022’ for C++ language compilation.
I’m at a loss for what this error could mean, so I would appreciate any help in interpreting it and getting this to work. c++, mex compiler MATLAB Answers — New Questions
Using drawpoint in 3d axes
Hello,
I have a program that plots the electrostatic potential created by electrons confined to a sphere. What I’d like to be able to do is grab one of those electrons and move it in the figure to see how the potential changes. What I’ve been able to do is project everything from the surface of the sphere onto 2D axes and use drawpoint to get the interactivity I want. However, I’m a little annoyed by the distortions inherent in the projection so before I go and add a bunch of other functionality I have in mind I want to see if I can get the interactivity while having everything remain on the sphere.
One strange thing is that while drawpoint will still create a Point object in 3D axes (constrained to z=0), it’s motion is distorted: upon clicking the point, it jumps away and will move as if constrained to a line parallel to the x- or y-axes. Once the cursor gets far enough away, however, its motion does follow the cursor, just with a constant offset. The magnitude of that offset is a function of the viewing angle: when looking straight down or up the point moves as expected, but a low angle makes the point get very confused.
The fact that the point is always on the xy-plane isn’t necessarily a deal-breaker, though I can already think of several issues. The bigger issue is of course the strange distorted motion. I assume there’s nothing I can really do to fix that, so my question is whether there might be a different way to achieve the same end – some sort of callback on a scatterplot that would update the coordinates based on the mouse position?
If not, I do have an idea for a compromise, but I figured this was interesting enough to ask.
Thanks!Hello,
I have a program that plots the electrostatic potential created by electrons confined to a sphere. What I’d like to be able to do is grab one of those electrons and move it in the figure to see how the potential changes. What I’ve been able to do is project everything from the surface of the sphere onto 2D axes and use drawpoint to get the interactivity I want. However, I’m a little annoyed by the distortions inherent in the projection so before I go and add a bunch of other functionality I have in mind I want to see if I can get the interactivity while having everything remain on the sphere.
One strange thing is that while drawpoint will still create a Point object in 3D axes (constrained to z=0), it’s motion is distorted: upon clicking the point, it jumps away and will move as if constrained to a line parallel to the x- or y-axes. Once the cursor gets far enough away, however, its motion does follow the cursor, just with a constant offset. The magnitude of that offset is a function of the viewing angle: when looking straight down or up the point moves as expected, but a low angle makes the point get very confused.
The fact that the point is always on the xy-plane isn’t necessarily a deal-breaker, though I can already think of several issues. The bigger issue is of course the strange distorted motion. I assume there’s nothing I can really do to fix that, so my question is whether there might be a different way to achieve the same end – some sort of callback on a scatterplot that would update the coordinates based on the mouse position?
If not, I do have an idea for a compromise, but I figured this was interesting enough to ask.
Thanks! Hello,
I have a program that plots the electrostatic potential created by electrons confined to a sphere. What I’d like to be able to do is grab one of those electrons and move it in the figure to see how the potential changes. What I’ve been able to do is project everything from the surface of the sphere onto 2D axes and use drawpoint to get the interactivity I want. However, I’m a little annoyed by the distortions inherent in the projection so before I go and add a bunch of other functionality I have in mind I want to see if I can get the interactivity while having everything remain on the sphere.
One strange thing is that while drawpoint will still create a Point object in 3D axes (constrained to z=0), it’s motion is distorted: upon clicking the point, it jumps away and will move as if constrained to a line parallel to the x- or y-axes. Once the cursor gets far enough away, however, its motion does follow the cursor, just with a constant offset. The magnitude of that offset is a function of the viewing angle: when looking straight down or up the point moves as expected, but a low angle makes the point get very confused.
The fact that the point is always on the xy-plane isn’t necessarily a deal-breaker, though I can already think of several issues. The bigger issue is of course the strange distorted motion. I assume there’s nothing I can really do to fix that, so my question is whether there might be a different way to achieve the same end – some sort of callback on a scatterplot that would update the coordinates based on the mouse position?
If not, I do have an idea for a compromise, but I figured this was interesting enough to ask.
Thanks! callback, 3d plots MATLAB Answers — New Questions
Unable to see uifigure object properties
Hi,
I’m very new to Matlab, I’m basically learning as I go. At the moment I’m working on getting a callback function for a group of two radio buttons to work. The aim of the buttons is to switch between a line graph and a bar graph. The buttons are created fine, and open in the figure but I can’t see the properties.
My script:
chartSwitchGroup = uibuttongroup(tab, ‘Position’, [30, screenSize(4) – 330, 1220, 40],’BorderType’,’none’);
rbLine = uiradiobutton(chartSwitchGroup, ‘Text’, ‘Line Graph’, ‘Position’, [10, 5, 105, 30], ‘Value’, true, ‘FontSize’,16);
rbBar = uiradiobutton(chartSwitchGroup, ‘Text’, ‘Bar Chart’, ‘Position’, [115, 5, 125, 30], ‘FontSize’,16);
rbBar
rbLine
Command window:
I’m just trying to see the properties, basically so I can see what they are and learn more but even when leaving the figure open, I still get the ‘no longer exists message’
rbBar =
RadioButton (Bar Chart) with properties:
Value: 0
Text: ‘Bar Chart’
Position: [115 5 125 30]
Show all properties
rbLine =
RadioButton (Line Graph) with properties:
Value: 1
Text: ‘Line Graph’
Position: [10 5 105 30]
Show all properties
Unable to display properties for variable rbLine because it no longer exists.
**EDIT: More intense googling suggests this could be something to do with nested functions? **Hi,
I’m very new to Matlab, I’m basically learning as I go. At the moment I’m working on getting a callback function for a group of two radio buttons to work. The aim of the buttons is to switch between a line graph and a bar graph. The buttons are created fine, and open in the figure but I can’t see the properties.
My script:
chartSwitchGroup = uibuttongroup(tab, ‘Position’, [30, screenSize(4) – 330, 1220, 40],’BorderType’,’none’);
rbLine = uiradiobutton(chartSwitchGroup, ‘Text’, ‘Line Graph’, ‘Position’, [10, 5, 105, 30], ‘Value’, true, ‘FontSize’,16);
rbBar = uiradiobutton(chartSwitchGroup, ‘Text’, ‘Bar Chart’, ‘Position’, [115, 5, 125, 30], ‘FontSize’,16);
rbBar
rbLine
Command window:
I’m just trying to see the properties, basically so I can see what they are and learn more but even when leaving the figure open, I still get the ‘no longer exists message’
rbBar =
RadioButton (Bar Chart) with properties:
Value: 0
Text: ‘Bar Chart’
Position: [115 5 125 30]
Show all properties
rbLine =
RadioButton (Line Graph) with properties:
Value: 1
Text: ‘Line Graph’
Position: [10 5 105 30]
Show all properties
Unable to display properties for variable rbLine because it no longer exists.
**EDIT: More intense googling suggests this could be something to do with nested functions? ** Hi,
I’m very new to Matlab, I’m basically learning as I go. At the moment I’m working on getting a callback function for a group of two radio buttons to work. The aim of the buttons is to switch between a line graph and a bar graph. The buttons are created fine, and open in the figure but I can’t see the properties.
My script:
chartSwitchGroup = uibuttongroup(tab, ‘Position’, [30, screenSize(4) – 330, 1220, 40],’BorderType’,’none’);
rbLine = uiradiobutton(chartSwitchGroup, ‘Text’, ‘Line Graph’, ‘Position’, [10, 5, 105, 30], ‘Value’, true, ‘FontSize’,16);
rbBar = uiradiobutton(chartSwitchGroup, ‘Text’, ‘Bar Chart’, ‘Position’, [115, 5, 125, 30], ‘FontSize’,16);
rbBar
rbLine
Command window:
I’m just trying to see the properties, basically so I can see what they are and learn more but even when leaving the figure open, I still get the ‘no longer exists message’
rbBar =
RadioButton (Bar Chart) with properties:
Value: 0
Text: ‘Bar Chart’
Position: [115 5 125 30]
Show all properties
rbLine =
RadioButton (Line Graph) with properties:
Value: 1
Text: ‘Line Graph’
Position: [10 5 105 30]
Show all properties
Unable to display properties for variable rbLine because it no longer exists.
**EDIT: More intense googling suggests this could be something to do with nested functions? ** properties, radio buttons MATLAB Answers — New Questions
Deriving flux and current from the manufacturers B-H curve for inputing values in saturable transformer
Hi,
I was simulating a saturable transformer. It is shown in the figure for hysteresis design tool that the curve is between flux and current. This is a bit confusing. Should we derive the flux and current values from the manufacturers B-H curve and transformer dimensions.
Thanks,Hi,
I was simulating a saturable transformer. It is shown in the figure for hysteresis design tool that the curve is between flux and current. This is a bit confusing. Should we derive the flux and current values from the manufacturers B-H curve and transformer dimensions.
Thanks, Hi,
I was simulating a saturable transformer. It is shown in the figure for hysteresis design tool that the curve is between flux and current. This is a bit confusing. Should we derive the flux and current values from the manufacturers B-H curve and transformer dimensions.
Thanks, saturable transforemer, b-h curve MATLAB Answers — New Questions
How to output text to Command Window if signal changes from 0 to 1 in Simulink
I want to output text to the command line in Simulink when a signal turns from 0 to 1.
For example, in my model, signal A is zero unless a condition is exceeded in the model, to where signal A is then turned to one. At that point, I want to write "Signal A is 1. Data is invalid" to the command window. I’m currently trying to use a MATLAB function block:
function a = fcn (u)
if u == 1
disp(‘Signal A is 1. Data is invalid’)
a = 1;
else
end
This doesn’t seem to work. any suggestions?I want to output text to the command line in Simulink when a signal turns from 0 to 1.
For example, in my model, signal A is zero unless a condition is exceeded in the model, to where signal A is then turned to one. At that point, I want to write "Signal A is 1. Data is invalid" to the command window. I’m currently trying to use a MATLAB function block:
function a = fcn (u)
if u == 1
disp(‘Signal A is 1. Data is invalid’)
a = 1;
else
end
This doesn’t seem to work. any suggestions? I want to output text to the command line in Simulink when a signal turns from 0 to 1.
For example, in my model, signal A is zero unless a condition is exceeded in the model, to where signal A is then turned to one. At that point, I want to write "Signal A is 1. Data is invalid" to the command window. I’m currently trying to use a MATLAB function block:
function a = fcn (u)
if u == 1
disp(‘Signal A is 1. Data is invalid’)
a = 1;
else
end
This doesn’t seem to work. any suggestions? simulink, if statement, command window MATLAB Answers — New Questions
How can I timeout from “fmincon” or “fminunc” in the Optimization toolbox when it gets stuck in some computation?
I would like to timeout from "fmincon" or "fminunc" in the Optimization toolbox when it gets stuck in some computation.I would like to timeout from "fmincon" or "fminunc" in the Optimization toolbox when it gets stuck in some computation. I would like to timeout from "fmincon" or "fminunc" in the Optimization toolbox when it gets stuck in some computation. fmincon, optimization, timeout MATLAB Answers — New Questions
Custom Toolbox Documentation for Nested Namespaces
I am trying to create a custom toolbox which has multiple, sometimes nested, namespaces. How do I structure my *.mlx help files such that they appear for all functions within the toolbox.
For example, say my toolbox has the form:
└───root
├───+toolbox
│ ├───+subpackage1
│ │ └───+subpackage3
│ │ myfcn.m
│ │
│ └───+subpackage2
└───doc
GettingStarted.mlx
I am able to run
doc toolbox
and recieve the "GettingStarted.mlx"
However, how can I structure documentation such that:
doc toolbox.subpackage1.subpackage2.myfcn
returns a *.mlx for myfcn?
Currently, the output is identical to help toolbox.subpackage1.subpackage2.myfcn
Attempted Solution:
I have tried to add this documentation as follows:
└───root
├───+toolbox
│ ├───+subpackage1
│ │ └───+subpackage3
│ │ myfcn.m
│ │
│ └───+subpackage2
└───doc
│ GettingStarted.mlx
│
└───toolbox
└───subpackage1
└───subpackage3
myfcn.mlx
However, the deeply nested documentation is not found. If I manually add ‘myfcn.mlx’ into the package Examples, it shows up in the documentation under the heading ‘subpackage3’, but this is not my desired behavior. I would like to maintain the entire tree in my documentation.
I have found packages discussing using info.xml & helptoc.xml, but it is not clear how to modify these for this situation. The documentation for these files can be found here: https://www.mathworks.com/help/matlab/matlab_prog/display-custom-documentation.htmlI am trying to create a custom toolbox which has multiple, sometimes nested, namespaces. How do I structure my *.mlx help files such that they appear for all functions within the toolbox.
For example, say my toolbox has the form:
└───root
├───+toolbox
│ ├───+subpackage1
│ │ └───+subpackage3
│ │ myfcn.m
│ │
│ └───+subpackage2
└───doc
GettingStarted.mlx
I am able to run
doc toolbox
and recieve the "GettingStarted.mlx"
However, how can I structure documentation such that:
doc toolbox.subpackage1.subpackage2.myfcn
returns a *.mlx for myfcn?
Currently, the output is identical to help toolbox.subpackage1.subpackage2.myfcn
Attempted Solution:
I have tried to add this documentation as follows:
└───root
├───+toolbox
│ ├───+subpackage1
│ │ └───+subpackage3
│ │ myfcn.m
│ │
│ └───+subpackage2
└───doc
│ GettingStarted.mlx
│
└───toolbox
└───subpackage1
└───subpackage3
myfcn.mlx
However, the deeply nested documentation is not found. If I manually add ‘myfcn.mlx’ into the package Examples, it shows up in the documentation under the heading ‘subpackage3’, but this is not my desired behavior. I would like to maintain the entire tree in my documentation.
I have found packages discussing using info.xml & helptoc.xml, but it is not clear how to modify these for this situation. The documentation for these files can be found here: https://www.mathworks.com/help/matlab/matlab_prog/display-custom-documentation.html I am trying to create a custom toolbox which has multiple, sometimes nested, namespaces. How do I structure my *.mlx help files such that they appear for all functions within the toolbox.
For example, say my toolbox has the form:
└───root
├───+toolbox
│ ├───+subpackage1
│ │ └───+subpackage3
│ │ myfcn.m
│ │
│ └───+subpackage2
└───doc
GettingStarted.mlx
I am able to run
doc toolbox
and recieve the "GettingStarted.mlx"
However, how can I structure documentation such that:
doc toolbox.subpackage1.subpackage2.myfcn
returns a *.mlx for myfcn?
Currently, the output is identical to help toolbox.subpackage1.subpackage2.myfcn
Attempted Solution:
I have tried to add this documentation as follows:
└───root
├───+toolbox
│ ├───+subpackage1
│ │ └───+subpackage3
│ │ myfcn.m
│ │
│ └───+subpackage2
└───doc
│ GettingStarted.mlx
│
└───toolbox
└───subpackage1
└───subpackage3
myfcn.mlx
However, the deeply nested documentation is not found. If I manually add ‘myfcn.mlx’ into the package Examples, it shows up in the documentation under the heading ‘subpackage3’, but this is not my desired behavior. I would like to maintain the entire tree in my documentation.
I have found packages discussing using info.xml & helptoc.xml, but it is not clear how to modify these for this situation. The documentation for these files can be found here: https://www.mathworks.com/help/matlab/matlab_prog/display-custom-documentation.html matlab, toolbox MATLAB Answers — New Questions
How to store count pixel in 3D viewing
Hi all,
I have one set of 3D images Dicom. below is one of the slices.
ok, lets look the the 3D image dicom here, the location (148, 109) have count is 323.
then after did the code below,
% For binary images (png format, each pixel just have value 1 and 0.)
clc
clear all
dataSetDir = fullfile(‘C:UsersAkmalDesktopI-131 256 28.02.2020I-131 SPECT NEMA VALIDATION 01112019 256X256 26.09.2021 petang’);
imageDir = fullfile(dataSetDir,’bnwaftersegmentation’);
imds = imageDatastore(imageDir);
for i = 1:3
% subplot(6,7,i)
I = readimage(imds,i);
% binary
Is{i} = logical(I);
end
% For 3D images spect
myFolder = (‘C:UsersAkmalDesktopI-131 256 28.02.2020I-131 SPECT NEMA VALIDATION 01112019 256X256 26.09.2021 petangdcmoriextract’);
filePattern = fullfile(myFolder, ‘*.dcm’); % Change to whatever pattern you need.
theFiles = dir(filePattern);
for K = 1 : length(theFiles)
baseFileName = theFiles(K).name;
fullFileName = fullfile(theFiles(K).folder, baseFileName);
fprintf(1, ‘Now reading %sn’, fullFileName);
% Now do whatever you want with this file name,
% such as reading it in as an image array with imread()
P(:,:,K) = double(dicomread(fullFileName));
P(:,:,K) = double(P(:,:,K)) .* double( Is{K} );
end
%for viewing as 3D images
Ds = smooth3(P);
figure
hiso = patch(isosurface(Ds,5),…
‘FaceColor’,[1,.75,.65],…
‘EdgeColor’,’none’);
hcap = patch(isocaps(P,5),…
‘FaceColor’,’interp’,…
‘EdgeColor’,’none’);
colormap copper
view(45,30)
axis tight
daspect([1,1,.8])
lightangle(45,30);
set(gcf,’Renderer’,’zbuffer’); lighting phong
isonormals(Ds,hiso)
set(hcap,’AmbientStrength’,.6)
set(hiso,’SpecularColorReflectance’,0,’SpecularExponent’,50)
the 3D viewing like below. But, if you look at the same coordinate, (148, 109), its not show the count itself (332). its show the z coordinate. How to do for the 3D viewing(isosurface) can stored also the counts itself (332)??Hi all,
I have one set of 3D images Dicom. below is one of the slices.
ok, lets look the the 3D image dicom here, the location (148, 109) have count is 323.
then after did the code below,
% For binary images (png format, each pixel just have value 1 and 0.)
clc
clear all
dataSetDir = fullfile(‘C:UsersAkmalDesktopI-131 256 28.02.2020I-131 SPECT NEMA VALIDATION 01112019 256X256 26.09.2021 petang’);
imageDir = fullfile(dataSetDir,’bnwaftersegmentation’);
imds = imageDatastore(imageDir);
for i = 1:3
% subplot(6,7,i)
I = readimage(imds,i);
% binary
Is{i} = logical(I);
end
% For 3D images spect
myFolder = (‘C:UsersAkmalDesktopI-131 256 28.02.2020I-131 SPECT NEMA VALIDATION 01112019 256X256 26.09.2021 petangdcmoriextract’);
filePattern = fullfile(myFolder, ‘*.dcm’); % Change to whatever pattern you need.
theFiles = dir(filePattern);
for K = 1 : length(theFiles)
baseFileName = theFiles(K).name;
fullFileName = fullfile(theFiles(K).folder, baseFileName);
fprintf(1, ‘Now reading %sn’, fullFileName);
% Now do whatever you want with this file name,
% such as reading it in as an image array with imread()
P(:,:,K) = double(dicomread(fullFileName));
P(:,:,K) = double(P(:,:,K)) .* double( Is{K} );
end
%for viewing as 3D images
Ds = smooth3(P);
figure
hiso = patch(isosurface(Ds,5),…
‘FaceColor’,[1,.75,.65],…
‘EdgeColor’,’none’);
hcap = patch(isocaps(P,5),…
‘FaceColor’,’interp’,…
‘EdgeColor’,’none’);
colormap copper
view(45,30)
axis tight
daspect([1,1,.8])
lightangle(45,30);
set(gcf,’Renderer’,’zbuffer’); lighting phong
isonormals(Ds,hiso)
set(hcap,’AmbientStrength’,.6)
set(hiso,’SpecularColorReflectance’,0,’SpecularExponent’,50)
the 3D viewing like below. But, if you look at the same coordinate, (148, 109), its not show the count itself (332). its show the z coordinate. How to do for the 3D viewing(isosurface) can stored also the counts itself (332)?? Hi all,
I have one set of 3D images Dicom. below is one of the slices.
ok, lets look the the 3D image dicom here, the location (148, 109) have count is 323.
then after did the code below,
% For binary images (png format, each pixel just have value 1 and 0.)
clc
clear all
dataSetDir = fullfile(‘C:UsersAkmalDesktopI-131 256 28.02.2020I-131 SPECT NEMA VALIDATION 01112019 256X256 26.09.2021 petang’);
imageDir = fullfile(dataSetDir,’bnwaftersegmentation’);
imds = imageDatastore(imageDir);
for i = 1:3
% subplot(6,7,i)
I = readimage(imds,i);
% binary
Is{i} = logical(I);
end
% For 3D images spect
myFolder = (‘C:UsersAkmalDesktopI-131 256 28.02.2020I-131 SPECT NEMA VALIDATION 01112019 256X256 26.09.2021 petangdcmoriextract’);
filePattern = fullfile(myFolder, ‘*.dcm’); % Change to whatever pattern you need.
theFiles = dir(filePattern);
for K = 1 : length(theFiles)
baseFileName = theFiles(K).name;
fullFileName = fullfile(theFiles(K).folder, baseFileName);
fprintf(1, ‘Now reading %sn’, fullFileName);
% Now do whatever you want with this file name,
% such as reading it in as an image array with imread()
P(:,:,K) = double(dicomread(fullFileName));
P(:,:,K) = double(P(:,:,K)) .* double( Is{K} );
end
%for viewing as 3D images
Ds = smooth3(P);
figure
hiso = patch(isosurface(Ds,5),…
‘FaceColor’,[1,.75,.65],…
‘EdgeColor’,’none’);
hcap = patch(isocaps(P,5),…
‘FaceColor’,’interp’,…
‘EdgeColor’,’none’);
colormap copper
view(45,30)
axis tight
daspect([1,1,.8])
lightangle(45,30);
set(gcf,’Renderer’,’zbuffer’); lighting phong
isonormals(Ds,hiso)
set(hcap,’AmbientStrength’,.6)
set(hiso,’SpecularColorReflectance’,0,’SpecularExponent’,50)
the 3D viewing like below. But, if you look at the same coordinate, (148, 109), its not show the count itself (332). its show the z coordinate. How to do for the 3D viewing(isosurface) can stored also the counts itself (332)?? image acquisition, image processing, image segmentation, digital image processing, image analysis, image MATLAB Answers — New Questions
Can’t install MATLAB Conector (online MATLAB) although downloaded from mathworks site
I have MATLAB online working. Tried to install MATLAB connector to synchronize with my laptop. On Preferances cannot find Controls -> Connector.
Also tried to dowload from Mathworks. Dowloaded ok, but double clicking got error: "Must be downloaded from Apps Store"?
Please help. Thanks.I have MATLAB online working. Tried to install MATLAB connector to synchronize with my laptop. On Preferances cannot find Controls -> Connector.
Also tried to dowload from Mathworks. Dowloaded ok, but double clicking got error: "Must be downloaded from Apps Store"?
Please help. Thanks. I have MATLAB online working. Tried to install MATLAB connector to synchronize with my laptop. On Preferances cannot find Controls -> Connector.
Also tried to dowload from Mathworks. Dowloaded ok, but double clicking got error: "Must be downloaded from Apps Store"?
Please help. Thanks. matlab connector, problems MATLAB Answers — New Questions
writeline stuck on busy when serial device connected to port not turned on.
I have a serial connection to an external device, which works perfect if the unit is connected and on, but if the unit is off or disconnected, the check on the serial port using writeline, writeread, or fprintf all result in Matlab getting stuck on busy. My PC is using a PCIe serial card, so the COM PORTs are present and the serialport function sets up the COM PORT for communication.
SComPort = 17;
SBaudRate = 9600;
SDataBits = 8;
SParity = "none";
SStopBits = 1;
SFlowControl = "hardware";
STimeout = 1;
SWriteTerminator = "CR";
SReadTerminator = "CR/LF";
try
SComm = serialport(sprintf(‘COM%i’,SComPort), SBaudRate,’Timeout’, STimeout);
SComm.DataBits = SDataBits;
SComm.Parity = SParity;
SComm.StopBits = SStopBits;
SComm.FlowControl = SFlowControl;
bSComm = true;
objS_IO.Valid = true;
configureTerminator(SComm, SReadTerminator, SWriteTerminator)
catch
disp(‘Unable to find S comm port!’);
bSComm = false;
SComm = [];
s = -1;
end
% All of these functions error out with the device disconnected or turned off.
response = writeread(SComm,"version");
writeline(SComm, "version");I have a serial connection to an external device, which works perfect if the unit is connected and on, but if the unit is off or disconnected, the check on the serial port using writeline, writeread, or fprintf all result in Matlab getting stuck on busy. My PC is using a PCIe serial card, so the COM PORTs are present and the serialport function sets up the COM PORT for communication.
SComPort = 17;
SBaudRate = 9600;
SDataBits = 8;
SParity = "none";
SStopBits = 1;
SFlowControl = "hardware";
STimeout = 1;
SWriteTerminator = "CR";
SReadTerminator = "CR/LF";
try
SComm = serialport(sprintf(‘COM%i’,SComPort), SBaudRate,’Timeout’, STimeout);
SComm.DataBits = SDataBits;
SComm.Parity = SParity;
SComm.StopBits = SStopBits;
SComm.FlowControl = SFlowControl;
bSComm = true;
objS_IO.Valid = true;
configureTerminator(SComm, SReadTerminator, SWriteTerminator)
catch
disp(‘Unable to find S comm port!’);
bSComm = false;
SComm = [];
s = -1;
end
% All of these functions error out with the device disconnected or turned off.
response = writeread(SComm,"version");
writeline(SComm, "version"); I have a serial connection to an external device, which works perfect if the unit is connected and on, but if the unit is off or disconnected, the check on the serial port using writeline, writeread, or fprintf all result in Matlab getting stuck on busy. My PC is using a PCIe serial card, so the COM PORTs are present and the serialport function sets up the COM PORT for communication.
SComPort = 17;
SBaudRate = 9600;
SDataBits = 8;
SParity = "none";
SStopBits = 1;
SFlowControl = "hardware";
STimeout = 1;
SWriteTerminator = "CR";
SReadTerminator = "CR/LF";
try
SComm = serialport(sprintf(‘COM%i’,SComPort), SBaudRate,’Timeout’, STimeout);
SComm.DataBits = SDataBits;
SComm.Parity = SParity;
SComm.StopBits = SStopBits;
SComm.FlowControl = SFlowControl;
bSComm = true;
objS_IO.Valid = true;
configureTerminator(SComm, SReadTerminator, SWriteTerminator)
catch
disp(‘Unable to find S comm port!’);
bSComm = false;
SComm = [];
s = -1;
end
% All of these functions error out with the device disconnected or turned off.
response = writeread(SComm,"version");
writeline(SComm, "version"); writeline, readwrite, serialport MATLAB Answers — New Questions
Simmetry constraints in multivariate regression.
Hi everyone! I wanted to know if there is the possibility of doing a multivariate regression, forcing the resulting matrix to be symmetrical.Hi everyone! I wanted to know if there is the possibility of doing a multivariate regression, forcing the resulting matrix to be symmetrical. Hi everyone! I wanted to know if there is the possibility of doing a multivariate regression, forcing the resulting matrix to be symmetrical. regression MATLAB Answers — New Questions
Repeated-measures ANOVA with no between-factor
Hi all!
I am trying to perform a two-way repeated measures ANOVA by using the function fitrm and ranova. I have two within-factors (e.g. Condition & Side) and no between-subject factors. I tried the code below, based on the different topics on the mathworks help page. Cause I have no between-subjects factor I thought i should use ~1 as constant. However, I keep getting the following error:
Error using RepeatedMeasuresModel.fit (line 1347)
The between-subjects design must have full column rank.
Error in fitrm (line 77)
s = RepeatedMeasuresModel.fit(ds,model,varargin{:});
Error in Statistics_JvdH_versie5 (line 7778)
rm_APMoS_MSZP = fitrm(t_APMoS_MSZP,’CWSaff-CWS2laff~1′,’WithinDesign’,Condition)
Does anyone know how to solve this problem? Or know another way to perform this analysis in matlab.
See code below:
t_APMoS_MSZP = table(MoS_AP_side1_CWS_MSZP,MoS_AP_side2_CWS_MSZP,MoS_AP_side1_FWS_MSZP,…
MoS_AP_side2_FWS_MSZP,MoS_AP_side1_CWS2_MSZP,MoS_AP_side2_CWS2_MSZP…
,’VariableNames’,{‘CWSside1′,’CWSside2′,’FWSside1′,’FWSside2′,’CWS2side1′,’CWS2side2’});
Condition = table([1 1 2 2 3 3]’,[1 2 1 2 1 2]’,’VariableNames’,{‘Condition’ ‘Side’});
rm_APMoS_MSZP = fitrm(t_APMoS_MSZP,’CWSside1-CWS2side2~1′,’WithinDesign’,Condition)
[b1_APMoS,A_APMoS,C_APMoS,D_APMoS] = ranova(rm_APMoS_MSZP,’WithinModel’,’Condition*Side’);Hi all!
I am trying to perform a two-way repeated measures ANOVA by using the function fitrm and ranova. I have two within-factors (e.g. Condition & Side) and no between-subject factors. I tried the code below, based on the different topics on the mathworks help page. Cause I have no between-subjects factor I thought i should use ~1 as constant. However, I keep getting the following error:
Error using RepeatedMeasuresModel.fit (line 1347)
The between-subjects design must have full column rank.
Error in fitrm (line 77)
s = RepeatedMeasuresModel.fit(ds,model,varargin{:});
Error in Statistics_JvdH_versie5 (line 7778)
rm_APMoS_MSZP = fitrm(t_APMoS_MSZP,’CWSaff-CWS2laff~1′,’WithinDesign’,Condition)
Does anyone know how to solve this problem? Or know another way to perform this analysis in matlab.
See code below:
t_APMoS_MSZP = table(MoS_AP_side1_CWS_MSZP,MoS_AP_side2_CWS_MSZP,MoS_AP_side1_FWS_MSZP,…
MoS_AP_side2_FWS_MSZP,MoS_AP_side1_CWS2_MSZP,MoS_AP_side2_CWS2_MSZP…
,’VariableNames’,{‘CWSside1′,’CWSside2′,’FWSside1′,’FWSside2′,’CWS2side1′,’CWS2side2’});
Condition = table([1 1 2 2 3 3]’,[1 2 1 2 1 2]’,’VariableNames’,{‘Condition’ ‘Side’});
rm_APMoS_MSZP = fitrm(t_APMoS_MSZP,’CWSside1-CWS2side2~1′,’WithinDesign’,Condition)
[b1_APMoS,A_APMoS,C_APMoS,D_APMoS] = ranova(rm_APMoS_MSZP,’WithinModel’,’Condition*Side’); Hi all!
I am trying to perform a two-way repeated measures ANOVA by using the function fitrm and ranova. I have two within-factors (e.g. Condition & Side) and no between-subject factors. I tried the code below, based on the different topics on the mathworks help page. Cause I have no between-subjects factor I thought i should use ~1 as constant. However, I keep getting the following error:
Error using RepeatedMeasuresModel.fit (line 1347)
The between-subjects design must have full column rank.
Error in fitrm (line 77)
s = RepeatedMeasuresModel.fit(ds,model,varargin{:});
Error in Statistics_JvdH_versie5 (line 7778)
rm_APMoS_MSZP = fitrm(t_APMoS_MSZP,’CWSaff-CWS2laff~1′,’WithinDesign’,Condition)
Does anyone know how to solve this problem? Or know another way to perform this analysis in matlab.
See code below:
t_APMoS_MSZP = table(MoS_AP_side1_CWS_MSZP,MoS_AP_side2_CWS_MSZP,MoS_AP_side1_FWS_MSZP,…
MoS_AP_side2_FWS_MSZP,MoS_AP_side1_CWS2_MSZP,MoS_AP_side2_CWS2_MSZP…
,’VariableNames’,{‘CWSside1′,’CWSside2′,’FWSside1′,’FWSside2′,’CWS2side1′,’CWS2side2’});
Condition = table([1 1 2 2 3 3]’,[1 2 1 2 1 2]’,’VariableNames’,{‘Condition’ ‘Side’});
rm_APMoS_MSZP = fitrm(t_APMoS_MSZP,’CWSside1-CWS2side2~1′,’WithinDesign’,Condition)
[b1_APMoS,A_APMoS,C_APMoS,D_APMoS] = ranova(rm_APMoS_MSZP,’WithinModel’,’Condition*Side’); repeated-measures anova, between-subjects factors, within-subject factors, fitrm, ranova MATLAB Answers — New Questions
I got not logic current from motor which value from numbers suddenly 0 value. I think I have problem with the connection but still cannot find the mistake
Above, This is my model simulink
this my current from motor .
I think i having wrong connection from Dc motor,H-bridge,controlled pwm voltageAbove, This is my model simulink
this my current from motor .
I think i having wrong connection from Dc motor,H-bridge,controlled pwm voltage Above, This is my model simulink
this my current from motor .
I think i having wrong connection from Dc motor,H-bridge,controlled pwm voltage ev, simulink, battery, plot MATLAB Answers — New Questions
Error when using exportgraphics function to save large vector graphics with transparency
When I tried to save a large vector graphic with transparency information using the exportgraphics function on my PC, an error occurred.
MATLAB version: 9.12.0.2529717 (R2022a) Update 8
Operating system: Microsoft Windows 10 Pro Version 10.0 (Build 19045)
Java version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
After plotting a large 3D vector graphic with complex perspectives and transparency relationships in a figure, I attempted to run the following code to save the figure:
exportgraphics(gca, ‘picture1.emf’, ‘BackgroundColor’, ‘none’, ‘ContentType’, ‘vector’)
However, the program threw an error.
The error message was:
Problem while processing in an OutputHelper. java.nio.file.NoSuchFileException:
C:Usersroom250AppDataLocalTempemf6382030724281275533.tmp
com.mathworks.hg.util.OutputHelperProcessingException: Problem while processing in an
OutputHelper. java.nio.file.NoSuchFileException:
C:Usersroom250AppDataLocalTempemf6382030724281275533.tmp
at com.mathworks.hg.util.HGVectorOutputHelper.close(HGVectorOutputHelper.java:245)
Caused by: com.mathworks.hg.print.OutputProcessingException: java.nio.file.NoSuchFileException:
C:Usersroom250AppDataLocalTempemf6382030724281275533.tmp
at com.mathworks.hg.print.MWEMFVectorStrategy.endJob(MWEMFVectorStrategy.java:144)
at com.mathworks.hg.util.HGVectorOutputHelper.close(HGVectorOutputHelper.java:241)
Caused by: java.nio.file.NoSuchFileException:
C:Usersroom250AppDataLocalTempemf6382030724281275533.tmp
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:230)
at java.nio.file.Files.newByteChannel(Files.java:361)
at java.nio.file.Files.newByteChannel(Files.java:407)
at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
at java.nio.file.Files.newInputStream(Files.java:152)
at java.nio.file.Files.copy(Files.java:3068)
at com.mathworks.hg.print.MWEMFVectorStrategy.endJob(MWEMFVectorStrategy.java:142)
… 1 more
I tried running MATLAB as an administrator and on a PC with higher memory, but the error persisted, and the error message remained the same. In addition, I checked the available storage space on my computer, and I have at least 390 GB of free space.
When I saved the same figure without transparency information as an image (using exportgraphics(gca, ‘picture1.emf’, ‘BackgroundColor’, ‘none’, ‘ContentType’, ‘image’)), the exportgraphics function worked correctly.
Furthermore, I plotted a smaller image and tried again to save it using exportgraphics(gca, ‘picture1.emf’, ‘BackgroundColor’, ‘none’, ‘ContentType’, ‘vector’), and the result was correct.
So, it seems that the exportgraphics function may not support saving larger images, or is there another reason?When I tried to save a large vector graphic with transparency information using the exportgraphics function on my PC, an error occurred.
MATLAB version: 9.12.0.2529717 (R2022a) Update 8
Operating system: Microsoft Windows 10 Pro Version 10.0 (Build 19045)
Java version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
After plotting a large 3D vector graphic with complex perspectives and transparency relationships in a figure, I attempted to run the following code to save the figure:
exportgraphics(gca, ‘picture1.emf’, ‘BackgroundColor’, ‘none’, ‘ContentType’, ‘vector’)
However, the program threw an error.
The error message was:
Problem while processing in an OutputHelper. java.nio.file.NoSuchFileException:
C:Usersroom250AppDataLocalTempemf6382030724281275533.tmp
com.mathworks.hg.util.OutputHelperProcessingException: Problem while processing in an
OutputHelper. java.nio.file.NoSuchFileException:
C:Usersroom250AppDataLocalTempemf6382030724281275533.tmp
at com.mathworks.hg.util.HGVectorOutputHelper.close(HGVectorOutputHelper.java:245)
Caused by: com.mathworks.hg.print.OutputProcessingException: java.nio.file.NoSuchFileException:
C:Usersroom250AppDataLocalTempemf6382030724281275533.tmp
at com.mathworks.hg.print.MWEMFVectorStrategy.endJob(MWEMFVectorStrategy.java:144)
at com.mathworks.hg.util.HGVectorOutputHelper.close(HGVectorOutputHelper.java:241)
Caused by: java.nio.file.NoSuchFileException:
C:Usersroom250AppDataLocalTempemf6382030724281275533.tmp
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:230)
at java.nio.file.Files.newByteChannel(Files.java:361)
at java.nio.file.Files.newByteChannel(Files.java:407)
at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
at java.nio.file.Files.newInputStream(Files.java:152)
at java.nio.file.Files.copy(Files.java:3068)
at com.mathworks.hg.print.MWEMFVectorStrategy.endJob(MWEMFVectorStrategy.java:142)
… 1 more
I tried running MATLAB as an administrator and on a PC with higher memory, but the error persisted, and the error message remained the same. In addition, I checked the available storage space on my computer, and I have at least 390 GB of free space.
When I saved the same figure without transparency information as an image (using exportgraphics(gca, ‘picture1.emf’, ‘BackgroundColor’, ‘none’, ‘ContentType’, ‘image’)), the exportgraphics function worked correctly.
Furthermore, I plotted a smaller image and tried again to save it using exportgraphics(gca, ‘picture1.emf’, ‘BackgroundColor’, ‘none’, ‘ContentType’, ‘vector’), and the result was correct.
So, it seems that the exportgraphics function may not support saving larger images, or is there another reason? When I tried to save a large vector graphic with transparency information using the exportgraphics function on my PC, an error occurred.
MATLAB version: 9.12.0.2529717 (R2022a) Update 8
Operating system: Microsoft Windows 10 Pro Version 10.0 (Build 19045)
Java version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
After plotting a large 3D vector graphic with complex perspectives and transparency relationships in a figure, I attempted to run the following code to save the figure:
exportgraphics(gca, ‘picture1.emf’, ‘BackgroundColor’, ‘none’, ‘ContentType’, ‘vector’)
However, the program threw an error.
The error message was:
Problem while processing in an OutputHelper. java.nio.file.NoSuchFileException:
C:Usersroom250AppDataLocalTempemf6382030724281275533.tmp
com.mathworks.hg.util.OutputHelperProcessingException: Problem while processing in an
OutputHelper. java.nio.file.NoSuchFileException:
C:Usersroom250AppDataLocalTempemf6382030724281275533.tmp
at com.mathworks.hg.util.HGVectorOutputHelper.close(HGVectorOutputHelper.java:245)
Caused by: com.mathworks.hg.print.OutputProcessingException: java.nio.file.NoSuchFileException:
C:Usersroom250AppDataLocalTempemf6382030724281275533.tmp
at com.mathworks.hg.print.MWEMFVectorStrategy.endJob(MWEMFVectorStrategy.java:144)
at com.mathworks.hg.util.HGVectorOutputHelper.close(HGVectorOutputHelper.java:241)
Caused by: java.nio.file.NoSuchFileException:
C:Usersroom250AppDataLocalTempemf6382030724281275533.tmp
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:230)
at java.nio.file.Files.newByteChannel(Files.java:361)
at java.nio.file.Files.newByteChannel(Files.java:407)
at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
at java.nio.file.Files.newInputStream(Files.java:152)
at java.nio.file.Files.copy(Files.java:3068)
at com.mathworks.hg.print.MWEMFVectorStrategy.endJob(MWEMFVectorStrategy.java:142)
… 1 more
I tried running MATLAB as an administrator and on a PC with higher memory, but the error persisted, and the error message remained the same. In addition, I checked the available storage space on my computer, and I have at least 390 GB of free space.
When I saved the same figure without transparency information as an image (using exportgraphics(gca, ‘picture1.emf’, ‘BackgroundColor’, ‘none’, ‘ContentType’, ‘image’)), the exportgraphics function worked correctly.
Furthermore, I plotted a smaller image and tried again to save it using exportgraphics(gca, ‘picture1.emf’, ‘BackgroundColor’, ‘none’, ‘ContentType’, ‘vector’), and the result was correct.
So, it seems that the exportgraphics function may not support saving larger images, or is there another reason? exportgraphics, error MATLAB Answers — New Questions
Help with assessing learners work
Hi All,
I am trying to assess students work for a reference solution below, but the problem is that when one thing is wrong, it is marking everything as wrong even though some elements of the learner’s code are correct. For example, say, UTM is correct but RREF is wrong, the assessment will also assess UTM as wrong. Is there a way I can fix this
function [AI UTM RREF INVA] = ROINVERSE(A)
%% Step 1: Matrix Validation
% Establish the Size of the Matrix [m n]
[m n] = size (A) ;
% Check if the Matrix is Square
if m~=n
error(‘Matrix Is Not Square’) ;
% Check Matrix For Singularity
elseif det(A) == 0
error(‘Matrix Is Not Invertible Since |A|=0’) ;
% Inform The User The Matrix Can Be Inverted
else
disp(‘The Matrix Is Invertible’) ;
end
%% Step 2: Augmented Matrix AI
AI = [A eye(m)] ;
%% Step 3: Upper Triangular Matrix UTM
UTM = AI ;
for i = 1:m
% Making All The Pivots = 1
UTM(i,:) = UTM(i,:)./UTM(i,i)
for j = i+1:n
% Making Values Below Pivots Equal to Zero
UTM(j,:) = UTM(j,:)-UTM(j,i)*UTM(i,:)
end
end
%% Step 4: Reduced Row Echelon Form RREF
RREF = UTM ;
for k = 1:(m-1)
for l = k+1:n
RREF(k,:) = RREF(k,:)-RREF(k,l)*RREF(l,:)
end
end
%% Step 5: Extract The Inverse Matrix INVA
INVA = RREF(1:m,(n+1):end)
endHi All,
I am trying to assess students work for a reference solution below, but the problem is that when one thing is wrong, it is marking everything as wrong even though some elements of the learner’s code are correct. For example, say, UTM is correct but RREF is wrong, the assessment will also assess UTM as wrong. Is there a way I can fix this
function [AI UTM RREF INVA] = ROINVERSE(A)
%% Step 1: Matrix Validation
% Establish the Size of the Matrix [m n]
[m n] = size (A) ;
% Check if the Matrix is Square
if m~=n
error(‘Matrix Is Not Square’) ;
% Check Matrix For Singularity
elseif det(A) == 0
error(‘Matrix Is Not Invertible Since |A|=0’) ;
% Inform The User The Matrix Can Be Inverted
else
disp(‘The Matrix Is Invertible’) ;
end
%% Step 2: Augmented Matrix AI
AI = [A eye(m)] ;
%% Step 3: Upper Triangular Matrix UTM
UTM = AI ;
for i = 1:m
% Making All The Pivots = 1
UTM(i,:) = UTM(i,:)./UTM(i,i)
for j = i+1:n
% Making Values Below Pivots Equal to Zero
UTM(j,:) = UTM(j,:)-UTM(j,i)*UTM(i,:)
end
end
%% Step 4: Reduced Row Echelon Form RREF
RREF = UTM ;
for k = 1:(m-1)
for l = k+1:n
RREF(k,:) = RREF(k,:)-RREF(k,l)*RREF(l,:)
end
end
%% Step 5: Extract The Inverse Matrix INVA
INVA = RREF(1:m,(n+1):end)
end Hi All,
I am trying to assess students work for a reference solution below, but the problem is that when one thing is wrong, it is marking everything as wrong even though some elements of the learner’s code are correct. For example, say, UTM is correct but RREF is wrong, the assessment will also assess UTM as wrong. Is there a way I can fix this
function [AI UTM RREF INVA] = ROINVERSE(A)
%% Step 1: Matrix Validation
% Establish the Size of the Matrix [m n]
[m n] = size (A) ;
% Check if the Matrix is Square
if m~=n
error(‘Matrix Is Not Square’) ;
% Check Matrix For Singularity
elseif det(A) == 0
error(‘Matrix Is Not Invertible Since |A|=0’) ;
% Inform The User The Matrix Can Be Inverted
else
disp(‘The Matrix Is Invertible’) ;
end
%% Step 2: Augmented Matrix AI
AI = [A eye(m)] ;
%% Step 3: Upper Triangular Matrix UTM
UTM = AI ;
for i = 1:m
% Making All The Pivots = 1
UTM(i,:) = UTM(i,:)./UTM(i,i)
for j = i+1:n
% Making Values Below Pivots Equal to Zero
UTM(j,:) = UTM(j,:)-UTM(j,i)*UTM(i,:)
end
end
%% Step 4: Reduced Row Echelon Form RREF
RREF = UTM ;
for k = 1:(m-1)
for l = k+1:n
RREF(k,:) = RREF(k,:)-RREF(k,l)*RREF(l,:)
end
end
%% Step 5: Extract The Inverse Matrix INVA
INVA = RREF(1:m,(n+1):end)
end matlab grader, assessments MATLAB Answers — New Questions
How plot density of function ?
i search for finding i have a function which i saw the density plot i want plot the same i need density plot like the picture
for this function
0.3200000000e1 / ((0.4000000000e0 * x – 0.8e0) ^ 2 + (0.8e0 * x + 0.4e0) ^ 2 + 0.12e1) – 0.5120000000e1 * x ^ 2 / ((0.4000000000e0 * x – 0.8e0) ^ 2 + (0.8e0 * x + 0.4e0) ^ 2 + 0.12e1) ^ 2i search for finding i have a function which i saw the density plot i want plot the same i need density plot like the picture
for this function
0.3200000000e1 / ((0.4000000000e0 * x – 0.8e0) ^ 2 + (0.8e0 * x + 0.4e0) ^ 2 + 0.12e1) – 0.5120000000e1 * x ^ 2 / ((0.4000000000e0 * x – 0.8e0) ^ 2 + (0.8e0 * x + 0.4e0) ^ 2 + 0.12e1) ^ 2 i search for finding i have a function which i saw the density plot i want plot the same i need density plot like the picture
for this function
0.3200000000e1 / ((0.4000000000e0 * x – 0.8e0) ^ 2 + (0.8e0 * x + 0.4e0) ^ 2 + 0.12e1) – 0.5120000000e1 * x ^ 2 / ((0.4000000000e0 * x – 0.8e0) ^ 2 + (0.8e0 * x + 0.4e0) ^ 2 + 0.12e1) ^ 2 plotting MATLAB Answers — New Questions
How to change my y-axis?
I want to change my y-axis so in the below from 0 to 100, and why my result give me the square (like grid) in the middleI want to change my y-axis so in the below from 0 to 100, and why my result give me the square (like grid) in the middle I want to change my y-axis so in the below from 0 to 100, and why my result give me the square (like grid) in the middle legend, axis MATLAB Answers — New Questions
How do I disable the (new) simulink zoom overview?
The bottom left corner of our simulink window is now occupied by this new overlay while zooming/panning around.
I wish to disable this as the overlay is more annoying than helpful to me.
How do I get rid of it?The bottom left corner of our simulink window is now occupied by this new overlay while zooming/panning around.
I wish to disable this as the overlay is more annoying than helpful to me.
How do I get rid of it? The bottom left corner of our simulink window is now occupied by this new overlay while zooming/panning around.
I wish to disable this as the overlay is more annoying than helpful to me.
How do I get rid of it? zoom, overview, navigate, pan, scoll, scale MATLAB Answers — New Questions
Use WLTC drive cycle data instead of step input
I’m currently working with the PMSM thermal model. I replaced the input speed (RPM) with custom WLTC speed data, specifically the first 50 points of the WLTC profile. I adjusted the simulation time to 50 seconds accordingly. I also interpolated my data to have a time interval of 0.01 seconds, and I verified the input RPM values using a plot—everything appears normal.
However, I encountered the following issues:
Torque Not Measured: In the simulation results , the demanded and achieved torques are not being measured.
Temperature Explosion: After around 10 seconds into the simulation, the motor temperature exhibits an unexpected and unrealistic spike or explosion.
I’ve carefully checked the input RPM data, and everything seems fine. What could be causing these issues? How can I resolve the torque measurement issue and fix the temperature explosion problem?
Any help or suggestions would be greatly appreciated!I’m currently working with the PMSM thermal model. I replaced the input speed (RPM) with custom WLTC speed data, specifically the first 50 points of the WLTC profile. I adjusted the simulation time to 50 seconds accordingly. I also interpolated my data to have a time interval of 0.01 seconds, and I verified the input RPM values using a plot—everything appears normal.
However, I encountered the following issues:
Torque Not Measured: In the simulation results , the demanded and achieved torques are not being measured.
Temperature Explosion: After around 10 seconds into the simulation, the motor temperature exhibits an unexpected and unrealistic spike or explosion.
I’ve carefully checked the input RPM data, and everything seems fine. What could be causing these issues? How can I resolve the torque measurement issue and fix the temperature explosion problem?
Any help or suggestions would be greatly appreciated! I’m currently working with the PMSM thermal model. I replaced the input speed (RPM) with custom WLTC speed data, specifically the first 50 points of the WLTC profile. I adjusted the simulation time to 50 seconds accordingly. I also interpolated my data to have a time interval of 0.01 seconds, and I verified the input RPM values using a plot—everything appears normal.
However, I encountered the following issues:
Torque Not Measured: In the simulation results , the demanded and achieved torques are not being measured.
Temperature Explosion: After around 10 seconds into the simulation, the motor temperature exhibits an unexpected and unrealistic spike or explosion.
I’ve carefully checked the input RPM data, and everything seems fine. What could be causing these issues? How can I resolve the torque measurement issue and fix the temperature explosion problem?
Any help or suggestions would be greatly appreciated! pmsm, simulink, pmsm thermal model MATLAB Answers — New Questions
Reconstructing signal using the IFFT
Hello, I am using the FFt to convert a time series signal into images by reshaping the matrix (N*N). But i am having hard time to get the original signal back from the images. IS it because in fft i am considering only the magnitude of the signal not the phase of the signal ? Is there any way to solve this proble. May be using STFT ot any kind of other techniquesHello, I am using the FFt to convert a time series signal into images by reshaping the matrix (N*N). But i am having hard time to get the original signal back from the images. IS it because in fft i am considering only the magnitude of the signal not the phase of the signal ? Is there any way to solve this proble. May be using STFT ot any kind of other techniques Hello, I am using the FFt to convert a time series signal into images by reshaping the matrix (N*N). But i am having hard time to get the original signal back from the images. IS it because in fft i am considering only the magnitude of the signal not the phase of the signal ? Is there any way to solve this proble. May be using STFT ot any kind of other techniques fft, ifft MATLAB Answers — New Questions