Tag Archives: matlab
Matlab Home. Possible to get the coders?
Hi Guys,
I have tried contacting sales but it looks like they don’t answer questions about Student or Home edition!
I am looking to get MatLab as a home user in order to learn MatLab/Simulink.
I am not doing a course at an Educational establishment but rather studying at home in my own time.
I’m interested in the following:
MatLab, Simulink, Audio System Toolbox, Signal Processing Toolbox, DSP System Toolbox, MatLab Coder and Simulink Coder
The problem is I cannot seem to add MatLab Coder and Simulink Coder to the order, they are missing in the Home edition although they are there in the student edition.
Is it not possible for me to get the Coders?
Cheers
AndyHi Guys,
I have tried contacting sales but it looks like they don’t answer questions about Student or Home edition!
I am looking to get MatLab as a home user in order to learn MatLab/Simulink.
I am not doing a course at an Educational establishment but rather studying at home in my own time.
I’m interested in the following:
MatLab, Simulink, Audio System Toolbox, Signal Processing Toolbox, DSP System Toolbox, MatLab Coder and Simulink Coder
The problem is I cannot seem to add MatLab Coder and Simulink Coder to the order, they are missing in the Home edition although they are there in the student edition.
Is it not possible for me to get the Coders?
Cheers
Andy Hi Guys,
I have tried contacting sales but it looks like they don’t answer questions about Student or Home edition!
I am looking to get MatLab as a home user in order to learn MatLab/Simulink.
I am not doing a course at an Educational establishment but rather studying at home in my own time.
I’m interested in the following:
MatLab, Simulink, Audio System Toolbox, Signal Processing Toolbox, DSP System Toolbox, MatLab Coder and Simulink Coder
The problem is I cannot seem to add MatLab Coder and Simulink Coder to the order, they are missing in the Home edition although they are there in the student edition.
Is it not possible for me to get the Coders?
Cheers
Andy matlab home, home license MATLAB Answers — New Questions
matlab RIS MBM Communication systems
Matlab完成RIS-MBM的相关系统设计,使系统在发射天线数N=20,接收天线数Nr=3,,RF镜个数为2的条件下,信噪比SNR=15dB时,使用QPSK调制条件下BER低于10-2。Matlab完成RIS-MBM的相关系统设计,使系统在发射天线数N=20,接收天线数Nr=3,,RF镜个数为2的条件下,信噪比SNR=15dB时,使用QPSK调制条件下BER低于10-2。 Matlab完成RIS-MBM的相关系统设计,使系统在发射天线数N=20,接收天线数Nr=3,,RF镜个数为2的条件下,信噪比SNR=15dB时,使用QPSK调制条件下BER低于10-2。 matlab MATLAB Answers — New Questions
pso algoritm in pv
i want to write pso algorithm for estimate . please help me about cost functioni want to write pso algorithm for estimate . please help me about cost function i want to write pso algorithm for estimate . please help me about cost function pso, pv MATLAB Answers — New Questions
passing variable from matlab to python using pyrunfile
Hi all,
I’ve been looking to find an answer for the following question;
I have a variable in my workspace that I need to use in a python script, which for some reason is more challenging in than expected. I have been looking around the Mathlab documentation which unfortunately has not been helpfull for me.
Any help to solve this would be greatly appreciated!
Sample code which I simplified for this message.
% Matlab: This is the line that calls function.py using var01, var02 and var03.
apply_cnn_command = pyrunfile ("function.py ‘" + var01 + var02 + var03+"’")
% In Python I am using the current code:
import sys
import os
import matlab.engine
eng= matlab.engine.start_matlab()
varpy01 = eng.workspace[var01]
% The error message: "Python Error: NameError: name var01 is not defined.Hi all,
I’ve been looking to find an answer for the following question;
I have a variable in my workspace that I need to use in a python script, which for some reason is more challenging in than expected. I have been looking around the Mathlab documentation which unfortunately has not been helpfull for me.
Any help to solve this would be greatly appreciated!
Sample code which I simplified for this message.
% Matlab: This is the line that calls function.py using var01, var02 and var03.
apply_cnn_command = pyrunfile ("function.py ‘" + var01 + var02 + var03+"’")
% In Python I am using the current code:
import sys
import os
import matlab.engine
eng= matlab.engine.start_matlab()
varpy01 = eng.workspace[var01]
% The error message: "Python Error: NameError: name var01 is not defined. Hi all,
I’ve been looking to find an answer for the following question;
I have a variable in my workspace that I need to use in a python script, which for some reason is more challenging in than expected. I have been looking around the Mathlab documentation which unfortunately has not been helpfull for me.
Any help to solve this would be greatly appreciated!
Sample code which I simplified for this message.
% Matlab: This is the line that calls function.py using var01, var02 and var03.
apply_cnn_command = pyrunfile ("function.py ‘" + var01 + var02 + var03+"’")
% In Python I am using the current code:
import sys
import os
import matlab.engine
eng= matlab.engine.start_matlab()
varpy01 = eng.workspace[var01]
% The error message: "Python Error: NameError: name var01 is not defined. pyrunfile, syntax, workspace variables MATLAB Answers — New Questions
Problem with converted TIFF image
I converted a png to tiff unsigned int16. The image resulting is completely black.
This a apart of my code:
% Convert to unsigned 16-bit integer
img_uint16 = uint16(double(img) / double(intmax(‘uint16’)) * 65535);
% Save the image as TIFF
tiffPath = fullfile(subfolderPath, [currentImage(1:end-4), ‘_converted.tif’]);
imwrite(img_uint16, tiffPath);I converted a png to tiff unsigned int16. The image resulting is completely black.
This a apart of my code:
% Convert to unsigned 16-bit integer
img_uint16 = uint16(double(img) / double(intmax(‘uint16’)) * 65535);
% Save the image as TIFF
tiffPath = fullfile(subfolderPath, [currentImage(1:end-4), ‘_converted.tif’]);
imwrite(img_uint16, tiffPath); I converted a png to tiff unsigned int16. The image resulting is completely black.
This a apart of my code:
% Convert to unsigned 16-bit integer
img_uint16 = uint16(double(img) / double(intmax(‘uint16’)) * 65535);
% Save the image as TIFF
tiffPath = fullfile(subfolderPath, [currentImage(1:end-4), ‘_converted.tif’]);
imwrite(img_uint16, tiffPath); tiff MATLAB Answers — New Questions
LS method in idetification ,control engeeniring
Hi,how are you?I have problem with that code,is about LS method with ARX model in identification,I should use xcorr command for EPS variable to compare it that how much is near to white noise ?Hi,how are you?I have problem with that code,is about LS method with ARX model in identification,I should use xcorr command for EPS variable to compare it that how much is near to white noise ? Hi,how are you?I have problem with that code,is about LS method with ARX model in identification,I should use xcorr command for EPS variable to compare it that how much is near to white noise ? control engeeniring MATLAB Answers — New Questions
FEM programs to solve ODE
I can’t understand the ‘feasmbl2’. Is that ok to map the matrix and vectors of different sizes?
It happens the error context as the following below:
error: ff(_,2): out of bound 1 (dimensions are 6×1)
error: called from
feasmbl2 at line 30 column 18
Ex351 at line 83 column 8
Here is my whole codes from the textbook, but it can’t run well.
%—————————————————————————-
% EX3.5.1
% to solve the ordinary differential equation given as
% a u” + b u’ + c u = 1, 0 < x < 1
% u(0) = 0 and u(1) = 0
% using 5 linear elements
%
% Variable descriptions
% k = element matrix
% f = element vector
% kk = system matrix
% ff = system vector
% index = a vector containing system dofs associated with each element
% bcdof = a vector containing dofs associated with boundary conditions
% bcval = a vector containing boundary condition values associated with
% the dofs in ‘bcdof’
%—————————————————————————-
%————————————
% input data for control parameters
%————————————
clear
nel=5; % number of elements
nnel=2; % number of nodes per element
ndof=1; % number of dofs per node
nnode=6; % total number of nodes in system
sdof=nnode*ndof; % total system dofs
%—————————————–
% input data for nodal coordinate values
%—————————————–
gcoord(1)=0.0; gcoord(2)=0.2; gcoord(3)=0.4; gcoord(4)=0.6;
gcoord(5)=0.8; gcoord(6)=1.0;
%—————————————————–
% input data for nodal connectivity for each element
%—————————————————–
nodes(1,1)=1; nodes(1,2)=2; nodes(2,1)=2; nodes(2,2)=3;
nodes(3,1)=3; nodes(3,2)=4; nodes(4,1)=4; nodes(4,2)=5;
nodes(5,1)=5; nodes(5,2)=6;
%—————————————–
% input data for coefficients of the ODE
%—————————————–
acoef=1; % coefficient ‘a’ of the diff eqn
bcoef=-3; % coefficient ‘b’ of the diff eqn
ccoef=2; % coefficient ‘c’ of the diff eqn
%————————————-
% input data for boundary conditions
%————————————-
bcdof(1)=1; % first node is constrained
bcval(1)=0; % whose described value is 0
bcdof(2)=6; % 6th node is constrained
bcval(2)=0; % whose described value is 0
%—————————————–
% initialization of matrices and vectors
%—————————————–
ff=zeros(sdof,1); % initialization of system force vector
kk=zeros(sdof,sdof); % initialization of system matrix
index=zeros(nnel*ndof,1); % initialization of index vector
%—————————————————————–
% computation of element matrices and vectors and their assembly
%—————————————————————–
for iel=1:nel % loop for the total number of elements
nl=nodes(iel,1); nr=nodes(iel,2); % extract nodes for (iel)-th element
xl=gcoord(nl); xr=gcoord(nr);% extract nodal coord values for the element
eleng=xr-xl; % element length
index=feeldof1(iel,nnel,ndof);% extract system dofs associated with element
k=feode2l(acoef,bcoef,ccoef,eleng); % compute element matrix
f=fef1l(xl,xr); % compute element vector
[kk,ff]=feasmbl2(kk,ff,k,f,index); % assemble element matrices and vectors
end
%—————————–
% apply boundary conditions
%————————-
[kk,ff]=feaplyc2(kk,ff,bcdof,bcval);
%—————————-
% solve the matrix equation
%—————————-
fsol=kkff;
%———————
% analytical solution
%———————
c1=0.5/exp(1);
c2=-0.5*(1+1/exp(1));
for i=1:nnode
x=gcoord(i);
esol(i)=c1*exp(2*x)+c2*exp(x)+1/2;
end
%————————————
% print both exact and fem solutions
%————————————
num=1:1:sdof;
store=[num’ fsol esol’]
%—————————————————————
Thanks a lot for helping to debug the code!!I can’t understand the ‘feasmbl2’. Is that ok to map the matrix and vectors of different sizes?
It happens the error context as the following below:
error: ff(_,2): out of bound 1 (dimensions are 6×1)
error: called from
feasmbl2 at line 30 column 18
Ex351 at line 83 column 8
Here is my whole codes from the textbook, but it can’t run well.
%—————————————————————————-
% EX3.5.1
% to solve the ordinary differential equation given as
% a u” + b u’ + c u = 1, 0 < x < 1
% u(0) = 0 and u(1) = 0
% using 5 linear elements
%
% Variable descriptions
% k = element matrix
% f = element vector
% kk = system matrix
% ff = system vector
% index = a vector containing system dofs associated with each element
% bcdof = a vector containing dofs associated with boundary conditions
% bcval = a vector containing boundary condition values associated with
% the dofs in ‘bcdof’
%—————————————————————————-
%————————————
% input data for control parameters
%————————————
clear
nel=5; % number of elements
nnel=2; % number of nodes per element
ndof=1; % number of dofs per node
nnode=6; % total number of nodes in system
sdof=nnode*ndof; % total system dofs
%—————————————–
% input data for nodal coordinate values
%—————————————–
gcoord(1)=0.0; gcoord(2)=0.2; gcoord(3)=0.4; gcoord(4)=0.6;
gcoord(5)=0.8; gcoord(6)=1.0;
%—————————————————–
% input data for nodal connectivity for each element
%—————————————————–
nodes(1,1)=1; nodes(1,2)=2; nodes(2,1)=2; nodes(2,2)=3;
nodes(3,1)=3; nodes(3,2)=4; nodes(4,1)=4; nodes(4,2)=5;
nodes(5,1)=5; nodes(5,2)=6;
%—————————————–
% input data for coefficients of the ODE
%—————————————–
acoef=1; % coefficient ‘a’ of the diff eqn
bcoef=-3; % coefficient ‘b’ of the diff eqn
ccoef=2; % coefficient ‘c’ of the diff eqn
%————————————-
% input data for boundary conditions
%————————————-
bcdof(1)=1; % first node is constrained
bcval(1)=0; % whose described value is 0
bcdof(2)=6; % 6th node is constrained
bcval(2)=0; % whose described value is 0
%—————————————–
% initialization of matrices and vectors
%—————————————–
ff=zeros(sdof,1); % initialization of system force vector
kk=zeros(sdof,sdof); % initialization of system matrix
index=zeros(nnel*ndof,1); % initialization of index vector
%—————————————————————–
% computation of element matrices and vectors and their assembly
%—————————————————————–
for iel=1:nel % loop for the total number of elements
nl=nodes(iel,1); nr=nodes(iel,2); % extract nodes for (iel)-th element
xl=gcoord(nl); xr=gcoord(nr);% extract nodal coord values for the element
eleng=xr-xl; % element length
index=feeldof1(iel,nnel,ndof);% extract system dofs associated with element
k=feode2l(acoef,bcoef,ccoef,eleng); % compute element matrix
f=fef1l(xl,xr); % compute element vector
[kk,ff]=feasmbl2(kk,ff,k,f,index); % assemble element matrices and vectors
end
%—————————–
% apply boundary conditions
%————————-
[kk,ff]=feaplyc2(kk,ff,bcdof,bcval);
%—————————-
% solve the matrix equation
%—————————-
fsol=kkff;
%———————
% analytical solution
%———————
c1=0.5/exp(1);
c2=-0.5*(1+1/exp(1));
for i=1:nnode
x=gcoord(i);
esol(i)=c1*exp(2*x)+c2*exp(x)+1/2;
end
%————————————
% print both exact and fem solutions
%————————————
num=1:1:sdof;
store=[num’ fsol esol’]
%—————————————————————
Thanks a lot for helping to debug the code!! I can’t understand the ‘feasmbl2’. Is that ok to map the matrix and vectors of different sizes?
It happens the error context as the following below:
error: ff(_,2): out of bound 1 (dimensions are 6×1)
error: called from
feasmbl2 at line 30 column 18
Ex351 at line 83 column 8
Here is my whole codes from the textbook, but it can’t run well.
%—————————————————————————-
% EX3.5.1
% to solve the ordinary differential equation given as
% a u” + b u’ + c u = 1, 0 < x < 1
% u(0) = 0 and u(1) = 0
% using 5 linear elements
%
% Variable descriptions
% k = element matrix
% f = element vector
% kk = system matrix
% ff = system vector
% index = a vector containing system dofs associated with each element
% bcdof = a vector containing dofs associated with boundary conditions
% bcval = a vector containing boundary condition values associated with
% the dofs in ‘bcdof’
%—————————————————————————-
%————————————
% input data for control parameters
%————————————
clear
nel=5; % number of elements
nnel=2; % number of nodes per element
ndof=1; % number of dofs per node
nnode=6; % total number of nodes in system
sdof=nnode*ndof; % total system dofs
%—————————————–
% input data for nodal coordinate values
%—————————————–
gcoord(1)=0.0; gcoord(2)=0.2; gcoord(3)=0.4; gcoord(4)=0.6;
gcoord(5)=0.8; gcoord(6)=1.0;
%—————————————————–
% input data for nodal connectivity for each element
%—————————————————–
nodes(1,1)=1; nodes(1,2)=2; nodes(2,1)=2; nodes(2,2)=3;
nodes(3,1)=3; nodes(3,2)=4; nodes(4,1)=4; nodes(4,2)=5;
nodes(5,1)=5; nodes(5,2)=6;
%—————————————–
% input data for coefficients of the ODE
%—————————————–
acoef=1; % coefficient ‘a’ of the diff eqn
bcoef=-3; % coefficient ‘b’ of the diff eqn
ccoef=2; % coefficient ‘c’ of the diff eqn
%————————————-
% input data for boundary conditions
%————————————-
bcdof(1)=1; % first node is constrained
bcval(1)=0; % whose described value is 0
bcdof(2)=6; % 6th node is constrained
bcval(2)=0; % whose described value is 0
%—————————————–
% initialization of matrices and vectors
%—————————————–
ff=zeros(sdof,1); % initialization of system force vector
kk=zeros(sdof,sdof); % initialization of system matrix
index=zeros(nnel*ndof,1); % initialization of index vector
%—————————————————————–
% computation of element matrices and vectors and their assembly
%—————————————————————–
for iel=1:nel % loop for the total number of elements
nl=nodes(iel,1); nr=nodes(iel,2); % extract nodes for (iel)-th element
xl=gcoord(nl); xr=gcoord(nr);% extract nodal coord values for the element
eleng=xr-xl; % element length
index=feeldof1(iel,nnel,ndof);% extract system dofs associated with element
k=feode2l(acoef,bcoef,ccoef,eleng); % compute element matrix
f=fef1l(xl,xr); % compute element vector
[kk,ff]=feasmbl2(kk,ff,k,f,index); % assemble element matrices and vectors
end
%—————————–
% apply boundary conditions
%————————-
[kk,ff]=feaplyc2(kk,ff,bcdof,bcval);
%—————————-
% solve the matrix equation
%—————————-
fsol=kkff;
%———————
% analytical solution
%———————
c1=0.5/exp(1);
c2=-0.5*(1+1/exp(1));
for i=1:nnode
x=gcoord(i);
esol(i)=c1*exp(2*x)+c2*exp(x)+1/2;
end
%————————————
% print both exact and fem solutions
%————————————
num=1:1:sdof;
store=[num’ fsol esol’]
%—————————————————————
Thanks a lot for helping to debug the code!! fem, feasmbl2, out of bound, ode MATLAB Answers — New Questions
how crop an image automatically without any coordinate?
Hello everyone. My original image width 841pixels x height 482 pixels. So, the problem here’s, I want to crop the image automatically with 512×512 pixels in the center of the lesion like the picture above. but my original image does not enough pixels to crop. Should I enlarge the original image first? What I meant is that, the pixels from the original image is enlarge from the original one. So, my objective have 2, first : if the orignal image does not enough pixels crop, I want Matlab to enlarge the pixels of the original image at first, then crop automatically into 512×512 pixels. Here, I attacth the image that I want to crop using square box. As you can see below picture, the square box detects the lesion ground truth below and crop it automatically. and also the original image I attached below.
Hope that you can help me out. Thank you.Hello everyone. My original image width 841pixels x height 482 pixels. So, the problem here’s, I want to crop the image automatically with 512×512 pixels in the center of the lesion like the picture above. but my original image does not enough pixels to crop. Should I enlarge the original image first? What I meant is that, the pixels from the original image is enlarge from the original one. So, my objective have 2, first : if the orignal image does not enough pixels crop, I want Matlab to enlarge the pixels of the original image at first, then crop automatically into 512×512 pixels. Here, I attacth the image that I want to crop using square box. As you can see below picture, the square box detects the lesion ground truth below and crop it automatically. and also the original image I attached below.
Hope that you can help me out. Thank you. Hello everyone. My original image width 841pixels x height 482 pixels. So, the problem here’s, I want to crop the image automatically with 512×512 pixels in the center of the lesion like the picture above. but my original image does not enough pixels to crop. Should I enlarge the original image first? What I meant is that, the pixels from the original image is enlarge from the original one. So, my objective have 2, first : if the orignal image does not enough pixels crop, I want Matlab to enlarge the pixels of the original image at first, then crop automatically into 512×512 pixels. Here, I attacth the image that I want to crop using square box. As you can see below picture, the square box detects the lesion ground truth below and crop it automatically. and also the original image I attached below.
Hope that you can help me out. Thank you. crop, square, automatic, enlarge, image MATLAB Answers — New Questions
How do I save 6bands layer stacked data in ENVI format?
I have layer stacked 6 bands of sentinel2 data which is in jp2 format after resizing green,red and nir to 20m resolution. I want to save this 6bands layer stacked data into ENVI format. I request you all to please suggest me how to do it.
I would appreciate your kind help.
DevendraI have layer stacked 6 bands of sentinel2 data which is in jp2 format after resizing green,red and nir to 20m resolution. I want to save this 6bands layer stacked data into ENVI format. I request you all to please suggest me how to do it.
I would appreciate your kind help.
Devendra I have layer stacked 6 bands of sentinel2 data which is in jp2 format after resizing green,red and nir to 20m resolution. I want to save this 6bands layer stacked data into ENVI format. I request you all to please suggest me how to do it.
I would appreciate your kind help.
Devendra how do i save 6bands layer stacked data in envi ? MATLAB Answers — New Questions
How can I remove my mathworks account ?
Hi,
I would like to remove my mathworks account. How can I do it ?
ThanksHi,
I would like to remove my mathworks account. How can I do it ?
Thanks Hi,
I would like to remove my mathworks account. How can I do it ?
Thanks remove account mathworks MATLAB Answers — New Questions
Available to write/save/store a half precision as 16 bit TIFF? otherwise 32 bit TIFF?
I found that half precision can express floating point number in 16 bit. Can I write/save/store a half precision as 16 bit TIFF? otherwise 32 bit TIFF? In my trials, the TIFF writing with 16 bit allows int16 and uint16 only, and int32, uint32, single for the TIFF writing with 32 bit only.
This is related to question below:
https://kr.mathworks.com/matlabcentral/answers/1633680-available-that-tiff-image-of-16-bit-unsigned-integer-has-smaxsamplevalue-of-ieee-floating-point-numb?s_tid=srchtitle
clc; clear all; close all;
Img = imread(‘cameraman.tif’);
ImgS = single(Img);
ImgN = ImgS/(max(ImgS,[],"all")+1);
figure; imagesc(ImgN); axis image; colormap(‘gray’); colorbar;
ImgH = half(ImgN);
t = Tiff(‘myimageHalf.tif’,’w’);
tagstruct.ImageLength = size(ImgH,1);
tagstruct.ImageWidth = size(ImgH,2);
tagstruct.Photometric = Tiff.Photometric.MinIsBlack;
tagstruct.BitsPerSample = 16;
tagstruct.SamplesPerPixel = 1;
tagstruct.SampleFormat = 1;
tagstruct.SMaxSampleValue = double(max(ImgH,[],"all"));
tagstruct.SMinSampleValue = double(min(ImgH,[],"all"));
tagstruct.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky;
tagstruct.Software = ‘MATLAB’;
setTag(t,tagstruct)
write(t,ImgH);
close(t);I found that half precision can express floating point number in 16 bit. Can I write/save/store a half precision as 16 bit TIFF? otherwise 32 bit TIFF? In my trials, the TIFF writing with 16 bit allows int16 and uint16 only, and int32, uint32, single for the TIFF writing with 32 bit only.
This is related to question below:
https://kr.mathworks.com/matlabcentral/answers/1633680-available-that-tiff-image-of-16-bit-unsigned-integer-has-smaxsamplevalue-of-ieee-floating-point-numb?s_tid=srchtitle
clc; clear all; close all;
Img = imread(‘cameraman.tif’);
ImgS = single(Img);
ImgN = ImgS/(max(ImgS,[],"all")+1);
figure; imagesc(ImgN); axis image; colormap(‘gray’); colorbar;
ImgH = half(ImgN);
t = Tiff(‘myimageHalf.tif’,’w’);
tagstruct.ImageLength = size(ImgH,1);
tagstruct.ImageWidth = size(ImgH,2);
tagstruct.Photometric = Tiff.Photometric.MinIsBlack;
tagstruct.BitsPerSample = 16;
tagstruct.SamplesPerPixel = 1;
tagstruct.SampleFormat = 1;
tagstruct.SMaxSampleValue = double(max(ImgH,[],"all"));
tagstruct.SMinSampleValue = double(min(ImgH,[],"all"));
tagstruct.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky;
tagstruct.Software = ‘MATLAB’;
setTag(t,tagstruct)
write(t,ImgH);
close(t); I found that half precision can express floating point number in 16 bit. Can I write/save/store a half precision as 16 bit TIFF? otherwise 32 bit TIFF? In my trials, the TIFF writing with 16 bit allows int16 and uint16 only, and int32, uint32, single for the TIFF writing with 32 bit only.
This is related to question below:
https://kr.mathworks.com/matlabcentral/answers/1633680-available-that-tiff-image-of-16-bit-unsigned-integer-has-smaxsamplevalue-of-ieee-floating-point-numb?s_tid=srchtitle
clc; clear all; close all;
Img = imread(‘cameraman.tif’);
ImgS = single(Img);
ImgN = ImgS/(max(ImgS,[],"all")+1);
figure; imagesc(ImgN); axis image; colormap(‘gray’); colorbar;
ImgH = half(ImgN);
t = Tiff(‘myimageHalf.tif’,’w’);
tagstruct.ImageLength = size(ImgH,1);
tagstruct.ImageWidth = size(ImgH,2);
tagstruct.Photometric = Tiff.Photometric.MinIsBlack;
tagstruct.BitsPerSample = 16;
tagstruct.SamplesPerPixel = 1;
tagstruct.SampleFormat = 1;
tagstruct.SMaxSampleValue = double(max(ImgH,[],"all"));
tagstruct.SMinSampleValue = double(min(ImgH,[],"all"));
tagstruct.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky;
tagstruct.Software = ‘MATLAB’;
setTag(t,tagstruct)
write(t,ImgH);
close(t); half, half precision, precision, tiff MATLAB Answers — New Questions
Parallel computing on cell array.
Hello,
In my code I’ve created an object oriented data type named ‘particle’ as a custom defined class.
particle wth numeric fields (positionx, positiony, velocityx, velocityy).
Creating a new particle is via the constructor of the particle class.
p1 = particle(1,1,4,4);
Because there are lots of particles, these are all stored in a cell array (which can handle any data type).
pArray = cell(1,n);
pArray{1} = p1;
Then access to the fields of any particle is simply by the dot notation.
pArray{1}.positionx;
pArray{1}.positiony;
pArray{1}.velocityx;
pArray{1}.velocityy;
and so forth….
I wanted to process the particles in pArray more quickly by dividing them among workers of the parallel pool. So I decided to convert pArray from a cell array to a distributed cell array.
pArray = distributed(pArray)
But now the fields of each particle cannot be accessed by this method using the dot notation. I’ve tried this both inside an spmd block and outside of an spmd block
The line here
pArray(1).positionx
gives the following error.
Error using indexing (line 40)
Distributed SUBSREF only supports () indexing unless the underlying data type is table.
Error in distributed/subsref>iSubsRefHelper (line 126)
[varargout{:}] = subsref(coDd, substruct(s_type, varargin));
Error in distributedutil.distributedSpmdWrapper>iInnerWrapper (line 82)
[varargout{:}] = fcnH( varargin{:} );
Error in spmd_feval_fcn>get_f/body (line 78)
[outCell{:}] = fcnH( inCell{:} );
Then within an spmd block these lines
spmd
pArray(1).positionx;
end
gives this error.
Error using matlab_tests3 (line 80)
Error detected on workers 3 6 7 8.
Caused by:
Error using indexing (line 27)
Distributed arrays only support simple subscripting.
I’ve just started using Matlab’s parallel computing functionality so I’m just learning at this stage.
Is there a way to access the field data of an OO data structure stored in a cell array when using parallel computing techniques?
Any advice would be very helpful.
Thank you
Phil.Hello,
In my code I’ve created an object oriented data type named ‘particle’ as a custom defined class.
particle wth numeric fields (positionx, positiony, velocityx, velocityy).
Creating a new particle is via the constructor of the particle class.
p1 = particle(1,1,4,4);
Because there are lots of particles, these are all stored in a cell array (which can handle any data type).
pArray = cell(1,n);
pArray{1} = p1;
Then access to the fields of any particle is simply by the dot notation.
pArray{1}.positionx;
pArray{1}.positiony;
pArray{1}.velocityx;
pArray{1}.velocityy;
and so forth….
I wanted to process the particles in pArray more quickly by dividing them among workers of the parallel pool. So I decided to convert pArray from a cell array to a distributed cell array.
pArray = distributed(pArray)
But now the fields of each particle cannot be accessed by this method using the dot notation. I’ve tried this both inside an spmd block and outside of an spmd block
The line here
pArray(1).positionx
gives the following error.
Error using indexing (line 40)
Distributed SUBSREF only supports () indexing unless the underlying data type is table.
Error in distributed/subsref>iSubsRefHelper (line 126)
[varargout{:}] = subsref(coDd, substruct(s_type, varargin));
Error in distributedutil.distributedSpmdWrapper>iInnerWrapper (line 82)
[varargout{:}] = fcnH( varargin{:} );
Error in spmd_feval_fcn>get_f/body (line 78)
[outCell{:}] = fcnH( inCell{:} );
Then within an spmd block these lines
spmd
pArray(1).positionx;
end
gives this error.
Error using matlab_tests3 (line 80)
Error detected on workers 3 6 7 8.
Caused by:
Error using indexing (line 27)
Distributed arrays only support simple subscripting.
I’ve just started using Matlab’s parallel computing functionality so I’m just learning at this stage.
Is there a way to access the field data of an OO data structure stored in a cell array when using parallel computing techniques?
Any advice would be very helpful.
Thank you
Phil. Hello,
In my code I’ve created an object oriented data type named ‘particle’ as a custom defined class.
particle wth numeric fields (positionx, positiony, velocityx, velocityy).
Creating a new particle is via the constructor of the particle class.
p1 = particle(1,1,4,4);
Because there are lots of particles, these are all stored in a cell array (which can handle any data type).
pArray = cell(1,n);
pArray{1} = p1;
Then access to the fields of any particle is simply by the dot notation.
pArray{1}.positionx;
pArray{1}.positiony;
pArray{1}.velocityx;
pArray{1}.velocityy;
and so forth….
I wanted to process the particles in pArray more quickly by dividing them among workers of the parallel pool. So I decided to convert pArray from a cell array to a distributed cell array.
pArray = distributed(pArray)
But now the fields of each particle cannot be accessed by this method using the dot notation. I’ve tried this both inside an spmd block and outside of an spmd block
The line here
pArray(1).positionx
gives the following error.
Error using indexing (line 40)
Distributed SUBSREF only supports () indexing unless the underlying data type is table.
Error in distributed/subsref>iSubsRefHelper (line 126)
[varargout{:}] = subsref(coDd, substruct(s_type, varargin));
Error in distributedutil.distributedSpmdWrapper>iInnerWrapper (line 82)
[varargout{:}] = fcnH( varargin{:} );
Error in spmd_feval_fcn>get_f/body (line 78)
[outCell{:}] = fcnH( inCell{:} );
Then within an spmd block these lines
spmd
pArray(1).positionx;
end
gives this error.
Error using matlab_tests3 (line 80)
Error detected on workers 3 6 7 8.
Caused by:
Error using indexing (line 27)
Distributed arrays only support simple subscripting.
I’ve just started using Matlab’s parallel computing functionality so I’m just learning at this stage.
Is there a way to access the field data of an OO data structure stored in a cell array when using parallel computing techniques?
Any advice would be very helpful.
Thank you
Phil. parallel computing, cell array, object oriented data type. MATLAB Answers — New Questions
Why is my code seemingly ignoring some of the for loop commands?
Hello, I’m new to MATLAB and I’m trying to create a user-defined function that acts like bin2dec using manual conversion of binary to decimal integer, but I can’t figure out why I’m getting outputs of "1" or no output value for x altogether. Can someone please help me understand what’s wrong with my code? Thank you!!
% mybin2dec takes one single valued text input argument representation of a binary number and converts it to a decimal integer
function b=mybin2dec(x)
x=input(‘Enter a binary number as a text input: ‘, ‘s’)
str2num(x)
n=length(x)-1
for y=[1:length(x)]
if x(y)==49
d=(1*(2^n))
n=n-1
elseif x(y)==48
d=(0*(2^n))
n=n-1
end
end
sum(d)Hello, I’m new to MATLAB and I’m trying to create a user-defined function that acts like bin2dec using manual conversion of binary to decimal integer, but I can’t figure out why I’m getting outputs of "1" or no output value for x altogether. Can someone please help me understand what’s wrong with my code? Thank you!!
% mybin2dec takes one single valued text input argument representation of a binary number and converts it to a decimal integer
function b=mybin2dec(x)
x=input(‘Enter a binary number as a text input: ‘, ‘s’)
str2num(x)
n=length(x)-1
for y=[1:length(x)]
if x(y)==49
d=(1*(2^n))
n=n-1
elseif x(y)==48
d=(0*(2^n))
n=n-1
end
end
sum(d) Hello, I’m new to MATLAB and I’m trying to create a user-defined function that acts like bin2dec using manual conversion of binary to decimal integer, but I can’t figure out why I’m getting outputs of "1" or no output value for x altogether. Can someone please help me understand what’s wrong with my code? Thank you!!
% mybin2dec takes one single valued text input argument representation of a binary number and converts it to a decimal integer
function b=mybin2dec(x)
x=input(‘Enter a binary number as a text input: ‘, ‘s’)
str2num(x)
n=length(x)-1
for y=[1:length(x)]
if x(y)==49
d=(1*(2^n))
n=n-1
elseif x(y)==48
d=(0*(2^n))
n=n-1
end
end
sum(d) for loop, bin2dec MATLAB Answers — New Questions
No longer seeing data from sim800l and pic18f4525
I have a sim800l v2 and a pic18f. It was sending data to thinspeak last year uisng gprs and http post.
I have not changed anything but it seems to stop working. Has something changed on the thingspeak end?I have a sim800l v2 and a pic18f. It was sending data to thinspeak last year uisng gprs and http post.
I have not changed anything but it seems to stop working. Has something changed on the thingspeak end? I have a sim800l v2 and a pic18f. It was sending data to thinspeak last year uisng gprs and http post.
I have not changed anything but it seems to stop working. Has something changed on the thingspeak end? thingspeak MATLAB Answers — New Questions
How do I plot a quiver plot without the tail?
I want the (head) arrows on the curve and no tail.I want the (head) arrows on the curve and no tail. I want the (head) arrows on the curve and no tail. quiver MATLAB Answers — New Questions
How do i create and image from alpha-numeric characters?
I have a library say the alphabet and numbers, I have and images say Marilyn Monroe(grayscale) now i want to make the sales man problem and the nearest neighbor assign the best possible pixel representation to convert the image into this library of alpha-numeric pixels.I have a library say the alphabet and numbers, I have and images say Marilyn Monroe(grayscale) now i want to make the sales man problem and the nearest neighbor assign the best possible pixel representation to convert the image into this library of alpha-numeric pixels. I have a library say the alphabet and numbers, I have and images say Marilyn Monroe(grayscale) now i want to make the sales man problem and the nearest neighbor assign the best possible pixel representation to convert the image into this library of alpha-numeric pixels. image processing, digital image processing MATLAB Answers — New Questions
Matlab tool to plot 3d phase portrait
I have the following system of differential equations
x’ = -alpha0 * x + beta0 * x * y;
y’ = alpha1 * y – beta1 * x * y;
z’ = -alpha2 * (z – 5.5)^3 – beta2 * x * y;
I wanted to take a look at the phase portrait of this system for various values of the coefficients. Is there an inbuilt matlab tool that can do that?I have the following system of differential equations
x’ = -alpha0 * x + beta0 * x * y;
y’ = alpha1 * y – beta1 * x * y;
z’ = -alpha2 * (z – 5.5)^3 – beta2 * x * y;
I wanted to take a look at the phase portrait of this system for various values of the coefficients. Is there an inbuilt matlab tool that can do that? I have the following system of differential equations
x’ = -alpha0 * x + beta0 * x * y;
y’ = alpha1 * y – beta1 * x * y;
z’ = -alpha2 * (z – 5.5)^3 – beta2 * x * y;
I wanted to take a look at the phase portrait of this system for various values of the coefficients. Is there an inbuilt matlab tool that can do that? dynamical system, differential equations, phase portrait, phase plane MATLAB Answers — New Questions
FOPTD with sinusoidal input
Hi. I have a system and i want to study only the OPEN LOOP response for the disturbe.
Here x is a sinusoidal function x = w/(w^2 + s^2) and Pd is a FOPTD.
Can anyone help me with that?Hi. I have a system and i want to study only the OPEN LOOP response for the disturbe.
Here x is a sinusoidal function x = w/(w^2 + s^2) and Pd is a FOPTD.
Can anyone help me with that? Hi. I have a system and i want to study only the OPEN LOOP response for the disturbe.
Here x is a sinusoidal function x = w/(w^2 + s^2) and Pd is a FOPTD.
Can anyone help me with that? foptd MATLAB Answers — New Questions
How to install Lcc-win32 C 2.4.1 in matlap
I need the Lcc-win32 C 2.4.1 in C:PROGRA~2MATLABR2013A~1syslcc compiler but it does not appear in matlab and I tried to install it from online but it didn’t work…so how to get the Lcc-win32 C 2.4.1 to show in matlab?I need the Lcc-win32 C 2.4.1 in C:PROGRA~2MATLABR2013A~1syslcc compiler but it does not appear in matlab and I tried to install it from online but it didn’t work…so how to get the Lcc-win32 C 2.4.1 to show in matlab? I need the Lcc-win32 C 2.4.1 in C:PROGRA~2MATLABR2013A~1syslcc compiler but it does not appear in matlab and I tried to install it from online but it didn’t work…so how to get the Lcc-win32 C 2.4.1 to show in matlab? matlab compiler, mex compiler MATLAB Answers — New Questions
Splitting columns of a table
Hi I have a datafile : https://drive.google.com/file/d/1pYtIqvwfjOYDzvfjeudBE5XzmXmlJFiV/view?usp=drive_link
I am trying to store it in a table using following program. It is not letting me split certain columns that have arrays as values, into different columns. Each column should have just one value. I have tried replaing the delimiter, regexp and splitvars, but they didnt work at all.
………………………………………………………………………………………………………
files = dir(‘mvn_lpw_l2_lpnt_20150301_v03_r02.csv’);
tab = readtable(files.name)
…………………………………………………………………
Would appreciate some help here. ThanksHi I have a datafile : https://drive.google.com/file/d/1pYtIqvwfjOYDzvfjeudBE5XzmXmlJFiV/view?usp=drive_link
I am trying to store it in a table using following program. It is not letting me split certain columns that have arrays as values, into different columns. Each column should have just one value. I have tried replaing the delimiter, regexp and splitvars, but they didnt work at all.
………………………………………………………………………………………………………
files = dir(‘mvn_lpw_l2_lpnt_20150301_v03_r02.csv’);
tab = readtable(files.name)
…………………………………………………………………
Would appreciate some help here. Thanks Hi I have a datafile : https://drive.google.com/file/d/1pYtIqvwfjOYDzvfjeudBE5XzmXmlJFiV/view?usp=drive_link
I am trying to store it in a table using following program. It is not letting me split certain columns that have arrays as values, into different columns. Each column should have just one value. I have tried replaing the delimiter, regexp and splitvars, but they didnt work at all.
………………………………………………………………………………………………………
files = dir(‘mvn_lpw_l2_lpnt_20150301_v03_r02.csv’);
tab = readtable(files.name)
…………………………………………………………………
Would appreciate some help here. Thanks #splitcolumns #delimiters MATLAB Answers — New Questions