Tag Archives: matlab
Would like to determine when a UDP packet is physically received
Hello,
Is there anyway to determine when a machine physically receives a UDP packet from the network?
Thanks!Hello,
Is there anyway to determine when a machine physically receives a UDP packet from the network?
Thanks! Hello,
Is there anyway to determine when a machine physically receives a UDP packet from the network?
Thanks! udp MATLAB Answers — New Questions
How to apply orientation constraints between two rigid bodies
I am trying to do an inverse kinematics analysis on a rigid body tree that has 3 rigid bodies, all with revolute joints, operating in a 2D plane. One of the contraints of the system that this is based off is that the first and third body must be parallel. How would I apply a constraint to ensure that this happens? I am attempting to mimic the physical motion of the model below, where the base frame is the hole near the top of the 3D model.I am trying to do an inverse kinematics analysis on a rigid body tree that has 3 rigid bodies, all with revolute joints, operating in a 2D plane. One of the contraints of the system that this is based off is that the first and third body must be parallel. How would I apply a constraint to ensure that this happens? I am attempting to mimic the physical motion of the model below, where the base frame is the hole near the top of the 3D model. I am trying to do an inverse kinematics analysis on a rigid body tree that has 3 rigid bodies, all with revolute joints, operating in a 2D plane. One of the contraints of the system that this is based off is that the first and third body must be parallel. How would I apply a constraint to ensure that this happens? I am attempting to mimic the physical motion of the model below, where the base frame is the hole near the top of the 3D model. robotics, inverse kinematics MATLAB Answers — New Questions
Arduino Fails to Program with “avrdude: ser_open(): can’t set com-state” Error
I have an Arduino Uno device and have attempted to attach it to one of my computer’s COM Ports via a USB cable. I have downloaded the MATLAB Support Package for Arduino Hardware, and ensured that it is correctly accessed by my MATLAB installation via the following commands:
>> restoredefaultpath
>> rehash toolboxcache
Following this, I enter the "arduinosetup" command into my MATLAB Command Window, and follow the instructions described in the following MATLAB Documentation:
https://www.mathworks.com/help/supportpkg/arduinoio/ug/configure-setup-for-arduino-hardware.html
I have ensured that I am selecting both the correct board as well as the correct COM port. However, when I press "Program", I receive the following error message:
Failed to program the arduino board. Click the following link to see the error log. Contact Technical support if you need more help.
Clicking the link in that message provides me a TXT file with a fairly large stack trace. The most important lines, however, seem to be at the end. These read the following:
avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:ProgramDataMATLABSupportPackagesR2023aaIDEhardwaretoolsavr/etc/avrdude.conf"
Using Port : COM5
Using Programmer : arduino
Overriding Baud Rate : 115200
avrdude: ser_open(): can’t set com-state for "\.COM5"
avrdude done. Thank you.
An error occurred while uploading the sketch
Upon receiving this error, I tried a few initial troubleshooting steps:Uninstalling and then reinstalling the MATLAB Support Package for Arduino Hardware.Connecting to a different COM port.Restarting both my system and my Arduino board.
Unfortunately, none of the above steps changed the resulting error message. How do I fix this and ensure that I am able to interact with my Arduino board via MATLAB?I have an Arduino Uno device and have attempted to attach it to one of my computer’s COM Ports via a USB cable. I have downloaded the MATLAB Support Package for Arduino Hardware, and ensured that it is correctly accessed by my MATLAB installation via the following commands:
>> restoredefaultpath
>> rehash toolboxcache
Following this, I enter the "arduinosetup" command into my MATLAB Command Window, and follow the instructions described in the following MATLAB Documentation:
https://www.mathworks.com/help/supportpkg/arduinoio/ug/configure-setup-for-arduino-hardware.html
I have ensured that I am selecting both the correct board as well as the correct COM port. However, when I press "Program", I receive the following error message:
Failed to program the arduino board. Click the following link to see the error log. Contact Technical support if you need more help.
Clicking the link in that message provides me a TXT file with a fairly large stack trace. The most important lines, however, seem to be at the end. These read the following:
avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:ProgramDataMATLABSupportPackagesR2023aaIDEhardwaretoolsavr/etc/avrdude.conf"
Using Port : COM5
Using Programmer : arduino
Overriding Baud Rate : 115200
avrdude: ser_open(): can’t set com-state for "\.COM5"
avrdude done. Thank you.
An error occurred while uploading the sketch
Upon receiving this error, I tried a few initial troubleshooting steps:Uninstalling and then reinstalling the MATLAB Support Package for Arduino Hardware.Connecting to a different COM port.Restarting both my system and my Arduino board.
Unfortunately, none of the above steps changed the resulting error message. How do I fix this and ensure that I am able to interact with my Arduino board via MATLAB? I have an Arduino Uno device and have attempted to attach it to one of my computer’s COM Ports via a USB cable. I have downloaded the MATLAB Support Package for Arduino Hardware, and ensured that it is correctly accessed by my MATLAB installation via the following commands:
>> restoredefaultpath
>> rehash toolboxcache
Following this, I enter the "arduinosetup" command into my MATLAB Command Window, and follow the instructions described in the following MATLAB Documentation:
https://www.mathworks.com/help/supportpkg/arduinoio/ug/configure-setup-for-arduino-hardware.html
I have ensured that I am selecting both the correct board as well as the correct COM port. However, when I press "Program", I receive the following error message:
Failed to program the arduino board. Click the following link to see the error log. Contact Technical support if you need more help.
Clicking the link in that message provides me a TXT file with a fairly large stack trace. The most important lines, however, seem to be at the end. These read the following:
avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:ProgramDataMATLABSupportPackagesR2023aaIDEhardwaretoolsavr/etc/avrdude.conf"
Using Port : COM5
Using Programmer : arduino
Overriding Baud Rate : 115200
avrdude: ser_open(): can’t set com-state for "\.COM5"
avrdude done. Thank you.
An error occurred while uploading the sketch
Upon receiving this error, I tried a few initial troubleshooting steps:Uninstalling and then reinstalling the MATLAB Support Package for Arduino Hardware.Connecting to a different COM port.Restarting both my system and my Arduino board.
Unfortunately, none of the above steps changed the resulting error message. How do I fix this and ensure that I am able to interact with my Arduino board via MATLAB? arduino, program, driver, drivers, avrdude, com, port MATLAB Answers — New Questions
thingspeak server closing connection immediately
mqtt3.thingspeak.com closing the connection immediately when trying to connect using A6 gsm module. Has been working flawlessly up to a week ago.Not able to publish any data to private channel. No encryption used (http).mqtt3.thingspeak.com closing the connection immediately when trying to connect using A6 gsm module. Has been working flawlessly up to a week ago.Not able to publish any data to private channel. No encryption used (http). mqtt3.thingspeak.com closing the connection immediately when trying to connect using A6 gsm module. Has been working flawlessly up to a week ago.Not able to publish any data to private channel. No encryption used (http). mqtt broker, tihngspeak MATLAB Answers — New Questions
Theoretical details regarding symbolic integration in Matlab
Dear all,
I am using symbolic integration in Matlab (in particular the "int"-function). I would like to use it as a reference in my research. Therefore, it would be nice to obtain some details which methods Matlab is actually using. Does anybody know? Is there a source to get more details?
Best,
MichaelDear all,
I am using symbolic integration in Matlab (in particular the "int"-function). I would like to use it as a reference in my research. Therefore, it would be nice to obtain some details which methods Matlab is actually using. Does anybody know? Is there a source to get more details?
Best,
Michael Dear all,
I am using symbolic integration in Matlab (in particular the "int"-function). I would like to use it as a reference in my research. Therefore, it would be nice to obtain some details which methods Matlab is actually using. Does anybody know? Is there a source to get more details?
Best,
Michael integration, symbolic, theory MATLAB Answers — New Questions
Why do I get different results on different machines when using “fmincon” from the Optimization Toolbox?
When I try to optimize my objective function with "fmincon", the optimization exits with a flag 0. However on a different machine, it exits with a flag 5. Why do these results differ?When I try to optimize my objective function with "fmincon", the optimization exits with a flag 0. However on a different machine, it exits with a flag 5. Why do these results differ? When I try to optimize my objective function with "fmincon", the optimization exits with a flag 0. However on a different machine, it exits with a flag 5. Why do these results differ? fmincon, condition, firstorderopt, optimization, numericalreproducibility MATLAB Answers — New Questions
app designer error: Attempt to add “theta” to a static workspace.
Hello, i wrote a code and it works while running the script. but when i use it in an app this error shows up Attempt to add "theta" to a static workspace. can somebody help me out. thanks
The code:
%% Constants and parameters
J1 = 1; % Polarization of outer magnet
J2 = 1; % Polarization of inner magnet
u0 = pi*4e-7; % Magnetic constant
%% Position vectors, define appropriately
r = [0.25, 0.3, 0.20 , 0.24]; % radius of magnets (outer to inner)
z = [0.05, 0.15, 0.08, 0.18]; % z cordinate of magnets (outer to inner)
%% main function g
g = @(a, b, c) computeG(a, b, c);
% Initialize F_Z
F_Z = 0;
% Compute F_Z based on the given formula
for i = 1:2
for k = 1:2
for j = 3:4
for l = 3:4
deltaZ = z(k) – z(l);
ri2 = r(i)^2;
rj2 = r(j)^2;
Fijkl = r(i) * r(j) * g(deltaZ, ri2+rj2+deltaZ^2, -2 * r(i) * r(j));
power = 1 + i + j + k + l;
F_Z = F_Z + ((-1)^power) * Fijkl;
end
end
end
end
F_Z = ((J1 * J2) / (2 * u0)) * F_Z;
%% Define the function computeG
function result = computeG(a, b, c)
A = (a^2 – b) / c * pi + sqrt(c^2 – (a^2 – b)^2) / c *(log((-16 * c^2) / ((c^2 – (a^2 – b)^2)^1.5)) + log(c^2 / ((c^2 – (a^2 – b)^2)^1.5)));
S = computeS(a, b, c);
result = A + S;
end
%% Define the function computeS
function S = computeS(a, b, c)
% Define constants
epsilon = c / (c – b);
beta = (b + c) / (b – c);
mu = c / (b + c);
% Calculate terms for S
term1 = (2 * 1i * a) / (c * sqrt(b + c)) * …
((b + c) * ellipticE(asin(sqrt(beta)), beta^(-1)) – c * ellipticF(asin(sqrt(beta)), beta^(-1)));
term2 = (2 * a) / (c * sqrt(b – c) * sqrt(epsilon)) * …
(c / sqrt(mu) * ellipticE1(1 / beta) – c * sqrt(mu) * ellipticK(1 / beta));
term3 = sqrt(epsilon * (1 / beta)) * …
((b – a^2) * ellipticK(2 * mu) + (a^2 – b + c) * ellipticPi(2 * c / (c + b – a^2), 2 * mu));
% Sum all terms
S = term1 + term2 + term3;
end
% Elliptic integral functions using symbolic math toolbox
function val = ellipticK(m)
syms theta;
val = double(int(1 / sqrt(1 – m * sin(theta)^2), theta, 0, pi/2));
end
function val = ellipticF(phi, m)
syms theta;
val = double(int(1 / sqrt(1 – m * sin(theta)^2), theta, 0, phi));
end
function val = ellipticE(phi, m)
syms theta;
val = double(int(sqrt(1 – m * sin(theta)^2), theta, 0, phi));
end
function val = ellipticE1(m)
syms theta;
val = double(int(sqrt(1 – m * sin(theta)^2), theta, 0, pi/2));
end
function val = ellipticPi(n, m)
syms theta;
val = double(int(1 / (sqrt(1 – n * sin(theta)^2) * sqrt(1 – m * sin(theta)^2)), theta, 0, pi/2));
endHello, i wrote a code and it works while running the script. but when i use it in an app this error shows up Attempt to add "theta" to a static workspace. can somebody help me out. thanks
The code:
%% Constants and parameters
J1 = 1; % Polarization of outer magnet
J2 = 1; % Polarization of inner magnet
u0 = pi*4e-7; % Magnetic constant
%% Position vectors, define appropriately
r = [0.25, 0.3, 0.20 , 0.24]; % radius of magnets (outer to inner)
z = [0.05, 0.15, 0.08, 0.18]; % z cordinate of magnets (outer to inner)
%% main function g
g = @(a, b, c) computeG(a, b, c);
% Initialize F_Z
F_Z = 0;
% Compute F_Z based on the given formula
for i = 1:2
for k = 1:2
for j = 3:4
for l = 3:4
deltaZ = z(k) – z(l);
ri2 = r(i)^2;
rj2 = r(j)^2;
Fijkl = r(i) * r(j) * g(deltaZ, ri2+rj2+deltaZ^2, -2 * r(i) * r(j));
power = 1 + i + j + k + l;
F_Z = F_Z + ((-1)^power) * Fijkl;
end
end
end
end
F_Z = ((J1 * J2) / (2 * u0)) * F_Z;
%% Define the function computeG
function result = computeG(a, b, c)
A = (a^2 – b) / c * pi + sqrt(c^2 – (a^2 – b)^2) / c *(log((-16 * c^2) / ((c^2 – (a^2 – b)^2)^1.5)) + log(c^2 / ((c^2 – (a^2 – b)^2)^1.5)));
S = computeS(a, b, c);
result = A + S;
end
%% Define the function computeS
function S = computeS(a, b, c)
% Define constants
epsilon = c / (c – b);
beta = (b + c) / (b – c);
mu = c / (b + c);
% Calculate terms for S
term1 = (2 * 1i * a) / (c * sqrt(b + c)) * …
((b + c) * ellipticE(asin(sqrt(beta)), beta^(-1)) – c * ellipticF(asin(sqrt(beta)), beta^(-1)));
term2 = (2 * a) / (c * sqrt(b – c) * sqrt(epsilon)) * …
(c / sqrt(mu) * ellipticE1(1 / beta) – c * sqrt(mu) * ellipticK(1 / beta));
term3 = sqrt(epsilon * (1 / beta)) * …
((b – a^2) * ellipticK(2 * mu) + (a^2 – b + c) * ellipticPi(2 * c / (c + b – a^2), 2 * mu));
% Sum all terms
S = term1 + term2 + term3;
end
% Elliptic integral functions using symbolic math toolbox
function val = ellipticK(m)
syms theta;
val = double(int(1 / sqrt(1 – m * sin(theta)^2), theta, 0, pi/2));
end
function val = ellipticF(phi, m)
syms theta;
val = double(int(1 / sqrt(1 – m * sin(theta)^2), theta, 0, phi));
end
function val = ellipticE(phi, m)
syms theta;
val = double(int(sqrt(1 – m * sin(theta)^2), theta, 0, phi));
end
function val = ellipticE1(m)
syms theta;
val = double(int(sqrt(1 – m * sin(theta)^2), theta, 0, pi/2));
end
function val = ellipticPi(n, m)
syms theta;
val = double(int(1 / (sqrt(1 – n * sin(theta)^2) * sqrt(1 – m * sin(theta)^2)), theta, 0, pi/2));
end Hello, i wrote a code and it works while running the script. but when i use it in an app this error shows up Attempt to add "theta" to a static workspace. can somebody help me out. thanks
The code:
%% Constants and parameters
J1 = 1; % Polarization of outer magnet
J2 = 1; % Polarization of inner magnet
u0 = pi*4e-7; % Magnetic constant
%% Position vectors, define appropriately
r = [0.25, 0.3, 0.20 , 0.24]; % radius of magnets (outer to inner)
z = [0.05, 0.15, 0.08, 0.18]; % z cordinate of magnets (outer to inner)
%% main function g
g = @(a, b, c) computeG(a, b, c);
% Initialize F_Z
F_Z = 0;
% Compute F_Z based on the given formula
for i = 1:2
for k = 1:2
for j = 3:4
for l = 3:4
deltaZ = z(k) – z(l);
ri2 = r(i)^2;
rj2 = r(j)^2;
Fijkl = r(i) * r(j) * g(deltaZ, ri2+rj2+deltaZ^2, -2 * r(i) * r(j));
power = 1 + i + j + k + l;
F_Z = F_Z + ((-1)^power) * Fijkl;
end
end
end
end
F_Z = ((J1 * J2) / (2 * u0)) * F_Z;
%% Define the function computeG
function result = computeG(a, b, c)
A = (a^2 – b) / c * pi + sqrt(c^2 – (a^2 – b)^2) / c *(log((-16 * c^2) / ((c^2 – (a^2 – b)^2)^1.5)) + log(c^2 / ((c^2 – (a^2 – b)^2)^1.5)));
S = computeS(a, b, c);
result = A + S;
end
%% Define the function computeS
function S = computeS(a, b, c)
% Define constants
epsilon = c / (c – b);
beta = (b + c) / (b – c);
mu = c / (b + c);
% Calculate terms for S
term1 = (2 * 1i * a) / (c * sqrt(b + c)) * …
((b + c) * ellipticE(asin(sqrt(beta)), beta^(-1)) – c * ellipticF(asin(sqrt(beta)), beta^(-1)));
term2 = (2 * a) / (c * sqrt(b – c) * sqrt(epsilon)) * …
(c / sqrt(mu) * ellipticE1(1 / beta) – c * sqrt(mu) * ellipticK(1 / beta));
term3 = sqrt(epsilon * (1 / beta)) * …
((b – a^2) * ellipticK(2 * mu) + (a^2 – b + c) * ellipticPi(2 * c / (c + b – a^2), 2 * mu));
% Sum all terms
S = term1 + term2 + term3;
end
% Elliptic integral functions using symbolic math toolbox
function val = ellipticK(m)
syms theta;
val = double(int(1 / sqrt(1 – m * sin(theta)^2), theta, 0, pi/2));
end
function val = ellipticF(phi, m)
syms theta;
val = double(int(1 / sqrt(1 – m * sin(theta)^2), theta, 0, phi));
end
function val = ellipticE(phi, m)
syms theta;
val = double(int(sqrt(1 – m * sin(theta)^2), theta, 0, phi));
end
function val = ellipticE1(m)
syms theta;
val = double(int(sqrt(1 – m * sin(theta)^2), theta, 0, pi/2));
end
function val = ellipticPi(n, m)
syms theta;
val = double(int(1 / (sqrt(1 – n * sin(theta)^2) * sqrt(1 – m * sin(theta)^2)), theta, 0, pi/2));
end appdesigner, app designer MATLAB Answers — New Questions
Speed of vpaintegral vs. int+vpa
Dear all,
I am currently testing the possibilities of integrating symbolic functions in Matlab. In the documentation of "int" (https://de.mathworks.com/help/symbolic/sym.int.html), I found the following statement which is not in agreement with my personal observations:
"To approximate integrals directly, use vpaintegral instead of vpa. The vpaintegral function is faster and provides control over integration tolerances."
I run the following example and observe that a combination of "int" and "vpa" needs 0.35 secs vs. 47.69 secs in case of "vpaintegral" both having the same precision of 32 valid digits.
syms x y
% define integration boundary
f1 = 0;
eqn = 0.980580675690920 * (0.4-x) – 0.196116135138184 * (1-y) == 0;
f2 = solve(eqn,y);
f3 = 1;
y_max = 0.5;
f = piecewise(x<0.2, min(f1,y_max), 0.2<=x<0.4, min(f2,y_max), …
x>=0.4, min(f3,y_max)); %#ok<CHAIN>
% define integrand
mon = x*y;
% integration over x-y-domain limited by the boundary, y=0, x=0 and x=0.5
tic
F = int(int(mon,y,0,f),x,0,0.5);
vpa(F)
toc
tic
vpaintegral(vpaintegral(mon,y,0,f),x,0,0.5,’RelTol’, 1e-32, ‘AbsTol’, 0)
toc
I am curious whether I miss something here.Dear all,
I am currently testing the possibilities of integrating symbolic functions in Matlab. In the documentation of "int" (https://de.mathworks.com/help/symbolic/sym.int.html), I found the following statement which is not in agreement with my personal observations:
"To approximate integrals directly, use vpaintegral instead of vpa. The vpaintegral function is faster and provides control over integration tolerances."
I run the following example and observe that a combination of "int" and "vpa" needs 0.35 secs vs. 47.69 secs in case of "vpaintegral" both having the same precision of 32 valid digits.
syms x y
% define integration boundary
f1 = 0;
eqn = 0.980580675690920 * (0.4-x) – 0.196116135138184 * (1-y) == 0;
f2 = solve(eqn,y);
f3 = 1;
y_max = 0.5;
f = piecewise(x<0.2, min(f1,y_max), 0.2<=x<0.4, min(f2,y_max), …
x>=0.4, min(f3,y_max)); %#ok<CHAIN>
% define integrand
mon = x*y;
% integration over x-y-domain limited by the boundary, y=0, x=0 and x=0.5
tic
F = int(int(mon,y,0,f),x,0,0.5);
vpa(F)
toc
tic
vpaintegral(vpaintegral(mon,y,0,f),x,0,0.5,’RelTol’, 1e-32, ‘AbsTol’, 0)
toc
I am curious whether I miss something here. Dear all,
I am currently testing the possibilities of integrating symbolic functions in Matlab. In the documentation of "int" (https://de.mathworks.com/help/symbolic/sym.int.html), I found the following statement which is not in agreement with my personal observations:
"To approximate integrals directly, use vpaintegral instead of vpa. The vpaintegral function is faster and provides control over integration tolerances."
I run the following example and observe that a combination of "int" and "vpa" needs 0.35 secs vs. 47.69 secs in case of "vpaintegral" both having the same precision of 32 valid digits.
syms x y
% define integration boundary
f1 = 0;
eqn = 0.980580675690920 * (0.4-x) – 0.196116135138184 * (1-y) == 0;
f2 = solve(eqn,y);
f3 = 1;
y_max = 0.5;
f = piecewise(x<0.2, min(f1,y_max), 0.2<=x<0.4, min(f2,y_max), …
x>=0.4, min(f3,y_max)); %#ok<CHAIN>
% define integrand
mon = x*y;
% integration over x-y-domain limited by the boundary, y=0, x=0 and x=0.5
tic
F = int(int(mon,y,0,f),x,0,0.5);
vpa(F)
toc
tic
vpaintegral(vpaintegral(mon,y,0,f),x,0,0.5,’RelTol’, 1e-32, ‘AbsTol’, 0)
toc
I am curious whether I miss something here. integral, speed MATLAB Answers — New Questions
Brace indexing is not supported for variables of this type.
Dear Matlab communities:
I am running a spm script for analyizing neuroimaging data, the first script here (ModelSpecificationBinaryMask.m) is to loop another job file ModelSpecificationBinaryMask_job.m over the two subjects while assigning the regressor files that correspond to each of the runs for one subject.
However, I am seeing the follwing errors:
Brace indexing is not supported for variables of this type.
Error in spm_jobman>canonicalise_jobs (line 415)
comp(i) = comp(i) && any(strcmp(fieldnames(job{i}{j}), …
Error in spm_jobman (line 152)
mljob = canonicalise_jobs(jobs);
Error in ModelSpecificationBinaryMask (line 50)
spm_jobman(‘run’, jobs, inputs);
ModelSpecificationBinaryMask.m
clear
close all
clc
% Created by GB on 9/9/19.
% Edited by LC on 8/19/24.
for sub = [101,102]
jobfile = {‘/Volumes/PUMPKIN/scripts/GabbyScripts/ModelSpecificationBinaryMaskTHRESHOFF_job.m’};
nrun = 1; % Assuming nrun should be 1 since we are processing one subject at a time
ncue = 8; % 8 runs for cue task
jobs = repmat(jobfile, 1, nrun);
inputs = cell(25, 1); % Initialize cell array for inputs (25 because you have 3 inputs per run and 8 runs)
% Create a homepath, a base location of all the data
homepath = ‘/Volumes/PUMPKIN/Preprocessed/groupA/Volumes’;
evpath = ‘/Volumes/PUMPKIN/Regressors’;
for n = 1:nrun
sub_path = fullfile(‘/Volumes/PUMPKIN/halfpipeXspm/sub-‘, num2str(sub(n)), ‘/1stLevel’);
%mkdir(sub_path);
inputs{1, n} = {sub_path}; % fMRI model specification: Directory – cfg_files
% Loop through each run for the subject
for run = 1:ncue
run_dir = fullfile(homepath, strcat(‘sub_’, num2str(sub(n))), ‘-‘, num2str(run));
% List all ‘vol_*.nii’ files in the current folder
files = dir(fullfile(run_dir, ‘vol_*.nii’));
if ~isempty(files)
% Now assign images
inputs{2+(run-1)*3, n} = {fullfile(run_dir, {files.name})}; % fMRI model specification: Scans – cfg_files
% Insert multiple condition files (i.e., evs)
ev_file = dir(fullfile(evpath, strcat(‘sub’, num2str(sub(n)), ‘run’, num2str(run), ‘_exev_CS_faceCue.mat’)));
inputs{3+(run-1)*3, n} = {fullfile(evpath, ev_file.name)};
% Insert multiple regressors (6 rigid body motion parameters)
rp_file = dir(fullfile(run_dir, ‘rp_af*.txt’));
inputs{4+(run-1)*3, n} = {fullfile(run_dir, rp_file.name)};
end
clear files rp_file
end
clear currfold
end
% Run the job using SPM
spm_jobman(‘run’, jobs, inputs);
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% ModelSpecificationBinaryMask_job.m
%———————————————————————–
% Job saved on 17-Jun-2016 14:21:03 by cfg_util (rev $Rev: 6134 $)
% spm SPM – SPM12 (6225)
% cfg_basicio BasicIO – Unknown
%———————————————————————–
disp(‘Script is running’);
matlabbatch(1).spm.stats.fmri_spec.dir = {‘/Volumes/PUMPKIN/halfpipeXspm/sub-*/1stLevel’};
matlabbatch(1).spm.stats.fmri_spec.timing.units = ‘secs’;
matlabbatch(1).spm.stats.fmri_spec.timing.RT = 2;
matlabbatch(1).spm.stats.fmri_spec.timing.fmri_t = 32;
matlabbatch(1).spm.stats.fmri_spec.timing.fmri_t0 = 1;
matlabbatch(1).spm.stats.fmri_spec.sess(1).scans = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(1).cond = struct(‘name’, {}, ‘onset’, {}, ‘duration’, {}, ‘tmod’, {}, ‘pmod’, {}, ‘orth’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(1).multi = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(1).regress = struct(‘name’, {}, ‘val’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(1).multi_reg = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(1).hpf = 128;
matlabbatch(1).spm.stats.fmri_spec.sess(2).scans = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(2).cond = struct(‘name’, {}, ‘onset’, {}, ‘duration’, {}, ‘tmod’, {}, ‘pmod’, {}, ‘orth’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(2).multi ='<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(2).regress = struct(‘name’, {}, ‘val’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(2).multi_reg = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(2).hpf = 128;
matlabbatch(1).spm.stats.fmri_spec.sess(3).scans = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(3).cond = struct(‘name’, {}, ‘onset’, {}, ‘duration’, {}, ‘tmod’, {}, ‘pmod’, {}, ‘orth’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(3).multi = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(3).regress = struct(‘name’, {}, ‘val’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(3).multi_reg = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(3).hpf = 128;
matlabbatch(1).spm.stats.fmri_spec.sess(4).scans = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(4).cond = struct(‘name’, {}, ‘onset’, {}, ‘duration’, {}, ‘tmod’, {}, ‘pmod’, {}, ‘orth’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(4).multi = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(4).regress = struct(‘name’, {}, ‘val’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(4).multi_reg = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(4).hpf = 128;
matlabbatch(1).spm.stats.fmri_spec.sess(5).scans = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(5).cond = struct(‘name’, {}, ‘onset’, {}, ‘duration’, {}, ‘tmod’, {}, ‘pmod’, {}, ‘orth’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(5).multi = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(5).regress = struct(‘name’, {}, ‘val’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(5).multi_reg = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(5).hpf = 128;
matlabbatch(1).spm.stats.fmri_spec.sess(6).scans = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(6).cond = struct(‘name’, {}, ‘onset’, {}, ‘duration’, {}, ‘tmod’, {}, ‘pmod’, {}, ‘orth’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(6).multi = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(6).regress = struct(‘name’, {}, ‘val’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(6).multi_reg = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(6).hpf = 128;
matlabbatch(1).spm.stats.fmri_spec.sess(7).scans = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(7).cond = struct(‘name’, {}, ‘onset’, {}, ‘duration’, {}, ‘tmod’, {}, ‘pmod’, {}, ‘orth’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(7).multi ='<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(7).regress = struct(‘name’, {}, ‘val’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(7).multi_reg = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(7).hpf = 128;
matlabbatch(1).spm.stats.fmri_spec.sess(8).scans = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(8).cond = struct(‘name’, {}, ‘onset’, {}, ‘duration’, {}, ‘tmod’, {}, ‘pmod’, {}, ‘orth’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(8).multi = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(8).regress = struct(‘name’, {}, ‘val’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(8).multi_reg = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(8).hpf = 128;
matlabbatch(1).spm.stats.fmri_spec.fact = struct(‘name’, {}, ‘levels’, {});
matlabbatch(1).spm.stats.fmri_spec.bases.hrf.derivs = [0 0];
matlabbatch(1).spm.stats.fmri_spec.volt = 1;
matlabbatch(1).spm.stats.fmri_spec.global = ‘None’;
matlabbatch(1).spm.stats.fmri_spec.mthresh = 0.0; %no voxels are thresholded so all voxels are being used%
matlabbatch(1).spm.stats.fmri_spec.mask = {‘/Volumes/PUMPKIN/scripts/LancyScripts/peripheral/C1-101-117/binarygreymattermask.nii’};
matlabbatch(1).spm.stats.fmri_spec.cvi = ‘AR(1)’;
disp(‘Script completed’);Dear Matlab communities:
I am running a spm script for analyizing neuroimaging data, the first script here (ModelSpecificationBinaryMask.m) is to loop another job file ModelSpecificationBinaryMask_job.m over the two subjects while assigning the regressor files that correspond to each of the runs for one subject.
However, I am seeing the follwing errors:
Brace indexing is not supported for variables of this type.
Error in spm_jobman>canonicalise_jobs (line 415)
comp(i) = comp(i) && any(strcmp(fieldnames(job{i}{j}), …
Error in spm_jobman (line 152)
mljob = canonicalise_jobs(jobs);
Error in ModelSpecificationBinaryMask (line 50)
spm_jobman(‘run’, jobs, inputs);
ModelSpecificationBinaryMask.m
clear
close all
clc
% Created by GB on 9/9/19.
% Edited by LC on 8/19/24.
for sub = [101,102]
jobfile = {‘/Volumes/PUMPKIN/scripts/GabbyScripts/ModelSpecificationBinaryMaskTHRESHOFF_job.m’};
nrun = 1; % Assuming nrun should be 1 since we are processing one subject at a time
ncue = 8; % 8 runs for cue task
jobs = repmat(jobfile, 1, nrun);
inputs = cell(25, 1); % Initialize cell array for inputs (25 because you have 3 inputs per run and 8 runs)
% Create a homepath, a base location of all the data
homepath = ‘/Volumes/PUMPKIN/Preprocessed/groupA/Volumes’;
evpath = ‘/Volumes/PUMPKIN/Regressors’;
for n = 1:nrun
sub_path = fullfile(‘/Volumes/PUMPKIN/halfpipeXspm/sub-‘, num2str(sub(n)), ‘/1stLevel’);
%mkdir(sub_path);
inputs{1, n} = {sub_path}; % fMRI model specification: Directory – cfg_files
% Loop through each run for the subject
for run = 1:ncue
run_dir = fullfile(homepath, strcat(‘sub_’, num2str(sub(n))), ‘-‘, num2str(run));
% List all ‘vol_*.nii’ files in the current folder
files = dir(fullfile(run_dir, ‘vol_*.nii’));
if ~isempty(files)
% Now assign images
inputs{2+(run-1)*3, n} = {fullfile(run_dir, {files.name})}; % fMRI model specification: Scans – cfg_files
% Insert multiple condition files (i.e., evs)
ev_file = dir(fullfile(evpath, strcat(‘sub’, num2str(sub(n)), ‘run’, num2str(run), ‘_exev_CS_faceCue.mat’)));
inputs{3+(run-1)*3, n} = {fullfile(evpath, ev_file.name)};
% Insert multiple regressors (6 rigid body motion parameters)
rp_file = dir(fullfile(run_dir, ‘rp_af*.txt’));
inputs{4+(run-1)*3, n} = {fullfile(run_dir, rp_file.name)};
end
clear files rp_file
end
clear currfold
end
% Run the job using SPM
spm_jobman(‘run’, jobs, inputs);
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% ModelSpecificationBinaryMask_job.m
%———————————————————————–
% Job saved on 17-Jun-2016 14:21:03 by cfg_util (rev $Rev: 6134 $)
% spm SPM – SPM12 (6225)
% cfg_basicio BasicIO – Unknown
%———————————————————————–
disp(‘Script is running’);
matlabbatch(1).spm.stats.fmri_spec.dir = {‘/Volumes/PUMPKIN/halfpipeXspm/sub-*/1stLevel’};
matlabbatch(1).spm.stats.fmri_spec.timing.units = ‘secs’;
matlabbatch(1).spm.stats.fmri_spec.timing.RT = 2;
matlabbatch(1).spm.stats.fmri_spec.timing.fmri_t = 32;
matlabbatch(1).spm.stats.fmri_spec.timing.fmri_t0 = 1;
matlabbatch(1).spm.stats.fmri_spec.sess(1).scans = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(1).cond = struct(‘name’, {}, ‘onset’, {}, ‘duration’, {}, ‘tmod’, {}, ‘pmod’, {}, ‘orth’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(1).multi = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(1).regress = struct(‘name’, {}, ‘val’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(1).multi_reg = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(1).hpf = 128;
matlabbatch(1).spm.stats.fmri_spec.sess(2).scans = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(2).cond = struct(‘name’, {}, ‘onset’, {}, ‘duration’, {}, ‘tmod’, {}, ‘pmod’, {}, ‘orth’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(2).multi ='<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(2).regress = struct(‘name’, {}, ‘val’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(2).multi_reg = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(2).hpf = 128;
matlabbatch(1).spm.stats.fmri_spec.sess(3).scans = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(3).cond = struct(‘name’, {}, ‘onset’, {}, ‘duration’, {}, ‘tmod’, {}, ‘pmod’, {}, ‘orth’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(3).multi = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(3).regress = struct(‘name’, {}, ‘val’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(3).multi_reg = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(3).hpf = 128;
matlabbatch(1).spm.stats.fmri_spec.sess(4).scans = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(4).cond = struct(‘name’, {}, ‘onset’, {}, ‘duration’, {}, ‘tmod’, {}, ‘pmod’, {}, ‘orth’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(4).multi = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(4).regress = struct(‘name’, {}, ‘val’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(4).multi_reg = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(4).hpf = 128;
matlabbatch(1).spm.stats.fmri_spec.sess(5).scans = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(5).cond = struct(‘name’, {}, ‘onset’, {}, ‘duration’, {}, ‘tmod’, {}, ‘pmod’, {}, ‘orth’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(5).multi = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(5).regress = struct(‘name’, {}, ‘val’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(5).multi_reg = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(5).hpf = 128;
matlabbatch(1).spm.stats.fmri_spec.sess(6).scans = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(6).cond = struct(‘name’, {}, ‘onset’, {}, ‘duration’, {}, ‘tmod’, {}, ‘pmod’, {}, ‘orth’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(6).multi = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(6).regress = struct(‘name’, {}, ‘val’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(6).multi_reg = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(6).hpf = 128;
matlabbatch(1).spm.stats.fmri_spec.sess(7).scans = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(7).cond = struct(‘name’, {}, ‘onset’, {}, ‘duration’, {}, ‘tmod’, {}, ‘pmod’, {}, ‘orth’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(7).multi ='<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(7).regress = struct(‘name’, {}, ‘val’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(7).multi_reg = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(7).hpf = 128;
matlabbatch(1).spm.stats.fmri_spec.sess(8).scans = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(8).cond = struct(‘name’, {}, ‘onset’, {}, ‘duration’, {}, ‘tmod’, {}, ‘pmod’, {}, ‘orth’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(8).multi = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(8).regress = struct(‘name’, {}, ‘val’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(8).multi_reg = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(8).hpf = 128;
matlabbatch(1).spm.stats.fmri_spec.fact = struct(‘name’, {}, ‘levels’, {});
matlabbatch(1).spm.stats.fmri_spec.bases.hrf.derivs = [0 0];
matlabbatch(1).spm.stats.fmri_spec.volt = 1;
matlabbatch(1).spm.stats.fmri_spec.global = ‘None’;
matlabbatch(1).spm.stats.fmri_spec.mthresh = 0.0; %no voxels are thresholded so all voxels are being used%
matlabbatch(1).spm.stats.fmri_spec.mask = {‘/Volumes/PUMPKIN/scripts/LancyScripts/peripheral/C1-101-117/binarygreymattermask.nii’};
matlabbatch(1).spm.stats.fmri_spec.cvi = ‘AR(1)’;
disp(‘Script completed’); Dear Matlab communities:
I am running a spm script for analyizing neuroimaging data, the first script here (ModelSpecificationBinaryMask.m) is to loop another job file ModelSpecificationBinaryMask_job.m over the two subjects while assigning the regressor files that correspond to each of the runs for one subject.
However, I am seeing the follwing errors:
Brace indexing is not supported for variables of this type.
Error in spm_jobman>canonicalise_jobs (line 415)
comp(i) = comp(i) && any(strcmp(fieldnames(job{i}{j}), …
Error in spm_jobman (line 152)
mljob = canonicalise_jobs(jobs);
Error in ModelSpecificationBinaryMask (line 50)
spm_jobman(‘run’, jobs, inputs);
ModelSpecificationBinaryMask.m
clear
close all
clc
% Created by GB on 9/9/19.
% Edited by LC on 8/19/24.
for sub = [101,102]
jobfile = {‘/Volumes/PUMPKIN/scripts/GabbyScripts/ModelSpecificationBinaryMaskTHRESHOFF_job.m’};
nrun = 1; % Assuming nrun should be 1 since we are processing one subject at a time
ncue = 8; % 8 runs for cue task
jobs = repmat(jobfile, 1, nrun);
inputs = cell(25, 1); % Initialize cell array for inputs (25 because you have 3 inputs per run and 8 runs)
% Create a homepath, a base location of all the data
homepath = ‘/Volumes/PUMPKIN/Preprocessed/groupA/Volumes’;
evpath = ‘/Volumes/PUMPKIN/Regressors’;
for n = 1:nrun
sub_path = fullfile(‘/Volumes/PUMPKIN/halfpipeXspm/sub-‘, num2str(sub(n)), ‘/1stLevel’);
%mkdir(sub_path);
inputs{1, n} = {sub_path}; % fMRI model specification: Directory – cfg_files
% Loop through each run for the subject
for run = 1:ncue
run_dir = fullfile(homepath, strcat(‘sub_’, num2str(sub(n))), ‘-‘, num2str(run));
% List all ‘vol_*.nii’ files in the current folder
files = dir(fullfile(run_dir, ‘vol_*.nii’));
if ~isempty(files)
% Now assign images
inputs{2+(run-1)*3, n} = {fullfile(run_dir, {files.name})}; % fMRI model specification: Scans – cfg_files
% Insert multiple condition files (i.e., evs)
ev_file = dir(fullfile(evpath, strcat(‘sub’, num2str(sub(n)), ‘run’, num2str(run), ‘_exev_CS_faceCue.mat’)));
inputs{3+(run-1)*3, n} = {fullfile(evpath, ev_file.name)};
% Insert multiple regressors (6 rigid body motion parameters)
rp_file = dir(fullfile(run_dir, ‘rp_af*.txt’));
inputs{4+(run-1)*3, n} = {fullfile(run_dir, rp_file.name)};
end
clear files rp_file
end
clear currfold
end
% Run the job using SPM
spm_jobman(‘run’, jobs, inputs);
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% ModelSpecificationBinaryMask_job.m
%———————————————————————–
% Job saved on 17-Jun-2016 14:21:03 by cfg_util (rev $Rev: 6134 $)
% spm SPM – SPM12 (6225)
% cfg_basicio BasicIO – Unknown
%———————————————————————–
disp(‘Script is running’);
matlabbatch(1).spm.stats.fmri_spec.dir = {‘/Volumes/PUMPKIN/halfpipeXspm/sub-*/1stLevel’};
matlabbatch(1).spm.stats.fmri_spec.timing.units = ‘secs’;
matlabbatch(1).spm.stats.fmri_spec.timing.RT = 2;
matlabbatch(1).spm.stats.fmri_spec.timing.fmri_t = 32;
matlabbatch(1).spm.stats.fmri_spec.timing.fmri_t0 = 1;
matlabbatch(1).spm.stats.fmri_spec.sess(1).scans = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(1).cond = struct(‘name’, {}, ‘onset’, {}, ‘duration’, {}, ‘tmod’, {}, ‘pmod’, {}, ‘orth’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(1).multi = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(1).regress = struct(‘name’, {}, ‘val’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(1).multi_reg = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(1).hpf = 128;
matlabbatch(1).spm.stats.fmri_spec.sess(2).scans = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(2).cond = struct(‘name’, {}, ‘onset’, {}, ‘duration’, {}, ‘tmod’, {}, ‘pmod’, {}, ‘orth’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(2).multi ='<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(2).regress = struct(‘name’, {}, ‘val’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(2).multi_reg = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(2).hpf = 128;
matlabbatch(1).spm.stats.fmri_spec.sess(3).scans = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(3).cond = struct(‘name’, {}, ‘onset’, {}, ‘duration’, {}, ‘tmod’, {}, ‘pmod’, {}, ‘orth’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(3).multi = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(3).regress = struct(‘name’, {}, ‘val’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(3).multi_reg = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(3).hpf = 128;
matlabbatch(1).spm.stats.fmri_spec.sess(4).scans = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(4).cond = struct(‘name’, {}, ‘onset’, {}, ‘duration’, {}, ‘tmod’, {}, ‘pmod’, {}, ‘orth’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(4).multi = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(4).regress = struct(‘name’, {}, ‘val’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(4).multi_reg = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(4).hpf = 128;
matlabbatch(1).spm.stats.fmri_spec.sess(5).scans = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(5).cond = struct(‘name’, {}, ‘onset’, {}, ‘duration’, {}, ‘tmod’, {}, ‘pmod’, {}, ‘orth’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(5).multi = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(5).regress = struct(‘name’, {}, ‘val’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(5).multi_reg = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(5).hpf = 128;
matlabbatch(1).spm.stats.fmri_spec.sess(6).scans = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(6).cond = struct(‘name’, {}, ‘onset’, {}, ‘duration’, {}, ‘tmod’, {}, ‘pmod’, {}, ‘orth’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(6).multi = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(6).regress = struct(‘name’, {}, ‘val’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(6).multi_reg = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(6).hpf = 128;
matlabbatch(1).spm.stats.fmri_spec.sess(7).scans = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(7).cond = struct(‘name’, {}, ‘onset’, {}, ‘duration’, {}, ‘tmod’, {}, ‘pmod’, {}, ‘orth’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(7).multi ='<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(7).regress = struct(‘name’, {}, ‘val’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(7).multi_reg = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(7).hpf = 128;
matlabbatch(1).spm.stats.fmri_spec.sess(8).scans = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(8).cond = struct(‘name’, {}, ‘onset’, {}, ‘duration’, {}, ‘tmod’, {}, ‘pmod’, {}, ‘orth’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(8).multi = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(8).regress = struct(‘name’, {}, ‘val’, {});
matlabbatch(1).spm.stats.fmri_spec.sess(8).multi_reg = ‘<UNDEFINED>’;
matlabbatch(1).spm.stats.fmri_spec.sess(8).hpf = 128;
matlabbatch(1).spm.stats.fmri_spec.fact = struct(‘name’, {}, ‘levels’, {});
matlabbatch(1).spm.stats.fmri_spec.bases.hrf.derivs = [0 0];
matlabbatch(1).spm.stats.fmri_spec.volt = 1;
matlabbatch(1).spm.stats.fmri_spec.global = ‘None’;
matlabbatch(1).spm.stats.fmri_spec.mthresh = 0.0; %no voxels are thresholded so all voxels are being used%
matlabbatch(1).spm.stats.fmri_spec.mask = {‘/Volumes/PUMPKIN/scripts/LancyScripts/peripheral/C1-101-117/binarygreymattermask.nii’};
matlabbatch(1).spm.stats.fmri_spec.cvi = ‘AR(1)’;
disp(‘Script completed’); spm, image processing, error MATLAB Answers — New Questions
Is there an “inverse” of decsg?
Is there a function that is like the invese of decsg? By that I mean: dl = decsg(gd) takes a geometry description matrix gd and returns a decomposed geometry description matrix dl. But what I need is the opposite: Given dl I need to "reconstitute" gd.Is there a function that is like the invese of decsg? By that I mean: dl = decsg(gd) takes a geometry description matrix gd and returns a decomposed geometry description matrix dl. But what I need is the opposite: Given dl I need to "reconstitute" gd. Is there a function that is like the invese of decsg? By that I mean: dl = decsg(gd) takes a geometry description matrix gd and returns a decomposed geometry description matrix dl. But what I need is the opposite: Given dl I need to "reconstitute" gd. decsg, geometry, pde toolbox MATLAB Answers — New Questions
VariSpec software in conjunction with MATLAB
I’m currently trying to use a laser alongside a VariSpec Liquid Crystal Tunable Filter (LCTF) for fluorescent imaging microscopy. Long story short, the software that goes with the microscope is Micro-Manager and the software for the LCTF is VSGUI (or VariSpecGUI).
I want to write code that will effectively carry out a sequence of events on the VSGUI and MM software for me using MATLAB, automatically. From what I’ve read, this is fairly straightforward to do for the Micro-Manager software as there’s some pre-written .m files / script that can be used for the operation of MM and if push comes to shove there is also the Microscopy Toolbox. However, with the VariSpec VSGUI software, I’m struggling to find any files relating to it. I know they exist because the manual for the LCTF states "CRi provides a set of MATLAB files to control VariSpec filters. There is a core support .DLL file and a series of .m files"
So great, the files exist and I don’t need to start from scratch, however, this CRi company does not seem to exist (think it might have been bought over?) and there are no websites that I can find with the files.
Long shot, but does anyone have any of the files that I’m talking about to operate the VariSpec filters?
I don’t think I’m fully capable of writing out a full script from scratch.I’m currently trying to use a laser alongside a VariSpec Liquid Crystal Tunable Filter (LCTF) for fluorescent imaging microscopy. Long story short, the software that goes with the microscope is Micro-Manager and the software for the LCTF is VSGUI (or VariSpecGUI).
I want to write code that will effectively carry out a sequence of events on the VSGUI and MM software for me using MATLAB, automatically. From what I’ve read, this is fairly straightforward to do for the Micro-Manager software as there’s some pre-written .m files / script that can be used for the operation of MM and if push comes to shove there is also the Microscopy Toolbox. However, with the VariSpec VSGUI software, I’m struggling to find any files relating to it. I know they exist because the manual for the LCTF states "CRi provides a set of MATLAB files to control VariSpec filters. There is a core support .DLL file and a series of .m files"
So great, the files exist and I don’t need to start from scratch, however, this CRi company does not seem to exist (think it might have been bought over?) and there are no websites that I can find with the files.
Long shot, but does anyone have any of the files that I’m talking about to operate the VariSpec filters?
I don’t think I’m fully capable of writing out a full script from scratch. I’m currently trying to use a laser alongside a VariSpec Liquid Crystal Tunable Filter (LCTF) for fluorescent imaging microscopy. Long story short, the software that goes with the microscope is Micro-Manager and the software for the LCTF is VSGUI (or VariSpecGUI).
I want to write code that will effectively carry out a sequence of events on the VSGUI and MM software for me using MATLAB, automatically. From what I’ve read, this is fairly straightforward to do for the Micro-Manager software as there’s some pre-written .m files / script that can be used for the operation of MM and if push comes to shove there is also the Microscopy Toolbox. However, with the VariSpec VSGUI software, I’m struggling to find any files relating to it. I know they exist because the manual for the LCTF states "CRi provides a set of MATLAB files to control VariSpec filters. There is a core support .DLL file and a series of .m files"
So great, the files exist and I don’t need to start from scratch, however, this CRi company does not seem to exist (think it might have been bought over?) and there are no websites that I can find with the files.
Long shot, but does anyone have any of the files that I’m talking about to operate the VariSpec filters?
I don’t think I’m fully capable of writing out a full script from scratch. varispec, .m files, vsgui, lctf, software MATLAB Answers — New Questions
R2018b does not complete initialisation
I have been using R2018b successfully for some time, but a few days ago it stopped working.
When I launch Matlab now it remains in the ‘Initialising’ state until I close it down. I cannot navigate to a folder or open the project or model.
I also have R2020b installed and that is still working ok.
There are no errors or warnings displayed.
I checked all the things mentioned in other similar discussions – license is ok, the preferences are not corrupted, the R2XXXx folder is not corrupted, stopping virus protection makes no difference.
I executed the command "matlab -timing" and the timing log contains this:
MATLAB Startup Performance Metrics (In Seconds)
total item gap description
=========================================================
0.00 0.00 0.00 MATLAB script
0.13 0.13 0.00 main
1.11 0.99 -0.00 Session Initialize
1.26 0.00 0.15 Toolbox cache load Start
1.30 0.05 0.00 LM Startup
1.58 0.01 0.27 splash
2.34 0.18 0.58 Constant Initialization
2.36 0.78 0.00 Engine Startup
2.58 0.22 0.00 InitSunVM
6.27 3.55 0.15 PostVMInit
6.28 3.92 0.00 mljInit
6.75 0.47 0.00 StartDesktop
6.75 4.39 0.00 Java initialization
6.89 0.01 0.13 psParser
9.18 2.43 6.75 Init Desktop
Any help would be much appreciated.I have been using R2018b successfully for some time, but a few days ago it stopped working.
When I launch Matlab now it remains in the ‘Initialising’ state until I close it down. I cannot navigate to a folder or open the project or model.
I also have R2020b installed and that is still working ok.
There are no errors or warnings displayed.
I checked all the things mentioned in other similar discussions – license is ok, the preferences are not corrupted, the R2XXXx folder is not corrupted, stopping virus protection makes no difference.
I executed the command "matlab -timing" and the timing log contains this:
MATLAB Startup Performance Metrics (In Seconds)
total item gap description
=========================================================
0.00 0.00 0.00 MATLAB script
0.13 0.13 0.00 main
1.11 0.99 -0.00 Session Initialize
1.26 0.00 0.15 Toolbox cache load Start
1.30 0.05 0.00 LM Startup
1.58 0.01 0.27 splash
2.34 0.18 0.58 Constant Initialization
2.36 0.78 0.00 Engine Startup
2.58 0.22 0.00 InitSunVM
6.27 3.55 0.15 PostVMInit
6.28 3.92 0.00 mljInit
6.75 0.47 0.00 StartDesktop
6.75 4.39 0.00 Java initialization
6.89 0.01 0.13 psParser
9.18 2.43 6.75 Init Desktop
Any help would be much appreciated. I have been using R2018b successfully for some time, but a few days ago it stopped working.
When I launch Matlab now it remains in the ‘Initialising’ state until I close it down. I cannot navigate to a folder or open the project or model.
I also have R2020b installed and that is still working ok.
There are no errors or warnings displayed.
I checked all the things mentioned in other similar discussions – license is ok, the preferences are not corrupted, the R2XXXx folder is not corrupted, stopping virus protection makes no difference.
I executed the command "matlab -timing" and the timing log contains this:
MATLAB Startup Performance Metrics (In Seconds)
total item gap description
=========================================================
0.00 0.00 0.00 MATLAB script
0.13 0.13 0.00 main
1.11 0.99 -0.00 Session Initialize
1.26 0.00 0.15 Toolbox cache load Start
1.30 0.05 0.00 LM Startup
1.58 0.01 0.27 splash
2.34 0.18 0.58 Constant Initialization
2.36 0.78 0.00 Engine Startup
2.58 0.22 0.00 InitSunVM
6.27 3.55 0.15 PostVMInit
6.28 3.92 0.00 mljInit
6.75 0.47 0.00 StartDesktop
6.75 4.39 0.00 Java initialization
6.89 0.01 0.13 psParser
9.18 2.43 6.75 Init Desktop
Any help would be much appreciated. r2018b, startup MATLAB Answers — New Questions
Find strings within other strings then pull data from that point
dear collegaes, please let me ask your help to find a solution for my data analisys.
I have a P0300.txt file that contains a long strip.
here is a portion of P0300.txt:
59 04 03 01 00 65 01 3E 51 09 00 00 51 1C 00 E1
I need to find sets of data, sets could be 2 or 4 digits.
lets say I need to find 01 3E
DATA = regexp(fileread(‘P0300.txt’), ‘r?n’, ‘split’)’;
>> A = string(DATA);
>> B = strfind(A,’01 3E’);
B gives me the position where 01 3E is, in this case B = 19
after this I need to extract the 6 digits on the rigth 51 09 00 <– this values can change depend on test conditions
Any idea on how can I do that?
your feedback will be highly appreciateddear collegaes, please let me ask your help to find a solution for my data analisys.
I have a P0300.txt file that contains a long strip.
here is a portion of P0300.txt:
59 04 03 01 00 65 01 3E 51 09 00 00 51 1C 00 E1
I need to find sets of data, sets could be 2 or 4 digits.
lets say I need to find 01 3E
DATA = regexp(fileread(‘P0300.txt’), ‘r?n’, ‘split’)’;
>> A = string(DATA);
>> B = strfind(A,’01 3E’);
B gives me the position where 01 3E is, in this case B = 19
after this I need to extract the 6 digits on the rigth 51 09 00 <– this values can change depend on test conditions
Any idea on how can I do that?
your feedback will be highly appreciated dear collegaes, please let me ask your help to find a solution for my data analisys.
I have a P0300.txt file that contains a long strip.
here is a portion of P0300.txt:
59 04 03 01 00 65 01 3E 51 09 00 00 51 1C 00 E1
I need to find sets of data, sets could be 2 or 4 digits.
lets say I need to find 01 3E
DATA = regexp(fileread(‘P0300.txt’), ‘r?n’, ‘split’)’;
>> A = string(DATA);
>> B = strfind(A,’01 3E’);
B gives me the position where 01 3E is, in this case B = 19
after this I need to extract the 6 digits on the rigth 51 09 00 <– this values can change depend on test conditions
Any idea on how can I do that?
your feedback will be highly appreciated strings, text, data MATLAB Answers — New Questions
Is there version compatibility for the Model Advisor Configuration?
I get the following error message when trying to load a MATLAB R2020a Model Advisor Configuration JSON file in MATLAB R2020b:
Unable to load check "mathworks.jmaab.jc_0627". The check information specified in configuration file might be different than information needed for this release of the check. For example, if the number of check input parameters has changed from a previous release when you open the configuration file, the check does not load.
I confirmed that the check "jc_0627" exists in both R2020a and R2020b.
To produce this issue, I selected only "Check usage of Discrete-Time Integrator block (jc_0627)" in Model Advisor and saved it as a JSON file through the Model Advisor Configuration Editor in MATLAB R2020a. Then I loaded the saved JSON in R2020b through Model Advisor Configuration Editor. However, when I tested the above same workflow in R2020b to R2021a, there is no compatibility issue. Why is there a discrepancy? I get the following error message when trying to load a MATLAB R2020a Model Advisor Configuration JSON file in MATLAB R2020b:
Unable to load check "mathworks.jmaab.jc_0627". The check information specified in configuration file might be different than information needed for this release of the check. For example, if the number of check input parameters has changed from a previous release when you open the configuration file, the check does not load.
I confirmed that the check "jc_0627" exists in both R2020a and R2020b.
To produce this issue, I selected only "Check usage of Discrete-Time Integrator block (jc_0627)" in Model Advisor and saved it as a JSON file through the Model Advisor Configuration Editor in MATLAB R2020a. Then I loaded the saved JSON in R2020b through Model Advisor Configuration Editor. However, when I tested the above same workflow in R2020b to R2021a, there is no compatibility issue. Why is there a discrepancy? I get the following error message when trying to load a MATLAB R2020a Model Advisor Configuration JSON file in MATLAB R2020b:
Unable to load check "mathworks.jmaab.jc_0627". The check information specified in configuration file might be different than information needed for this release of the check. For example, if the number of check input parameters has changed from a previous release when you open the configuration file, the check does not load.
I confirmed that the check "jc_0627" exists in both R2020a and R2020b.
To produce this issue, I selected only "Check usage of Discrete-Time Integrator block (jc_0627)" in Model Advisor and saved it as a JSON file through the Model Advisor Configuration Editor in MATLAB R2020a. Then I loaded the saved JSON in R2020b through Model Advisor Configuration Editor. However, when I tested the above same workflow in R2020b to R2021a, there is no compatibility issue. Why is there a discrepancy? modeladvisorconfiguration, modeladvisor, simulinkcheck MATLAB Answers — New Questions
I need to run Optimization using models I generated in Regression Learner
Hi, all!
I desperately need help. As the title says, I generated multiple surrogate models on Regression Learner; now I need to use these models in a gradient-based optimization process.
I’ve tried Export>Generate Function & Export>Export Model / Export Model For Deployment. None of them work, I don’t understand how anything works. If I can convert the surrogate models into matlab functions, these matlab functions are supposed to go into the ‘select problem data>Objective function’? How do I define lower/upper bounds with just one value for each when the surrogate models have multiple inputs?? How do I define non-linear constraints??
I put an image just to explain my problem better.
Thank you….Hi, all!
I desperately need help. As the title says, I generated multiple surrogate models on Regression Learner; now I need to use these models in a gradient-based optimization process.
I’ve tried Export>Generate Function & Export>Export Model / Export Model For Deployment. None of them work, I don’t understand how anything works. If I can convert the surrogate models into matlab functions, these matlab functions are supposed to go into the ‘select problem data>Objective function’? How do I define lower/upper bounds with just one value for each when the surrogate models have multiple inputs?? How do I define non-linear constraints??
I put an image just to explain my problem better.
Thank you…. Hi, all!
I desperately need help. As the title says, I generated multiple surrogate models on Regression Learner; now I need to use these models in a gradient-based optimization process.
I’ve tried Export>Generate Function & Export>Export Model / Export Model For Deployment. None of them work, I don’t understand how anything works. If I can convert the surrogate models into matlab functions, these matlab functions are supposed to go into the ‘select problem data>Objective function’? How do I define lower/upper bounds with just one value for each when the surrogate models have multiple inputs?? How do I define non-linear constraints??
I put an image just to explain my problem better.
Thank you…. optimization MATLAB Answers — New Questions
Why does MATLAB Statistics and Machine Learning Toolbox “manova1” give different results than R?
I am performing the one-way MANOVA in MATLAB using "manova1" from Statistics and Machine Learning Toolbox. Why are the resultant values different than the results obtained from R?I am performing the one-way MANOVA in MATLAB using "manova1" from Statistics and Machine Learning Toolbox. Why are the resultant values different than the results obtained from R? I am performing the one-way MANOVA in MATLAB using "manova1" from Statistics and Machine Learning Toolbox. Why are the resultant values different than the results obtained from R? manova, manova1, barttest MATLAB Answers — New Questions
How do I find libraries with unsaved changes?
I’m trying to build code via rtwbuild and am being met with the error Selected subsystem is linked to a library with unsaved changes. Please save the library.
I’ve been manually looking through the model and can’t see anything with unsaved changes or broken links. And there seems to be no easy way to find the library with unsaved changes in question. Am I missing something or is there a way to find these libraries? I’m working with a very big model.I’m trying to build code via rtwbuild and am being met with the error Selected subsystem is linked to a library with unsaved changes. Please save the library.
I’ve been manually looking through the model and can’t see anything with unsaved changes or broken links. And there seems to be no easy way to find the library with unsaved changes in question. Am I missing something or is there a way to find these libraries? I’m working with a very big model. I’m trying to build code via rtwbuild and am being met with the error Selected subsystem is linked to a library with unsaved changes. Please save the library.
I’ve been manually looking through the model and can’t see anything with unsaved changes or broken links. And there seems to be no easy way to find the library with unsaved changes in question. Am I missing something or is there a way to find these libraries? I’m working with a very big model. simulink MATLAB Answers — New Questions
Why does the update installer fail with “Error: ENOENT: no such file or directory” and mentions an appdata folder?
Why do I receive the error "Error: ENOENT: no such file or directory, scandir ‘C:Program FilesMATLABR20XXyappdataproducts’"Why do I receive the error "Error: ENOENT: no such file or directory, scandir ‘C:Program FilesMATLABR20XXyappdataproducts’" Why do I receive the error "Error: ENOENT: no such file or directory, scandir ‘C:Program FilesMATLABR20XXyappdataproducts’" MATLAB Answers — New Questions
Help to create a continuous surface heatmap
Dear experts –
I want to create a continuous 1D surface heatmap for every data point, with Distance (ft) in the X-direction and Temperature in the Y-direction. I have no idea how to do it. Please, can someone helps me with that.
Here I attached a sample of my data.
Thank you!Dear experts –
I want to create a continuous 1D surface heatmap for every data point, with Distance (ft) in the X-direction and Temperature in the Y-direction. I have no idea how to do it. Please, can someone helps me with that.
Here I attached a sample of my data.
Thank you! Dear experts –
I want to create a continuous 1D surface heatmap for every data point, with Distance (ft) in the X-direction and Temperature in the Y-direction. I have no idea how to do it. Please, can someone helps me with that.
Here I attached a sample of my data.
Thank you! heatmap MATLAB Answers — New Questions
Why am I getting a computed maximum size is not bounded error in a MATLAB Function block in Simulink R2021a even when using assert?
I am using a Matlab function in Simulink and want to create arrays whose size varies. However, I can specify the maximum size in advance. I got the following error message, although I am already using the assert function.
Computed maximum size of the output of function ‘colon’ is not bounded. Static memory allocation requires all sizes to be bounded. The computed size is [1 x :?]. More informationFunction ‘Control_Model/Current Controller ILR and PI/MATLAB Function’ (#24.2546.2574), line 86, column 24: "iL_NL_act:1:(iL_NL_act_plLL)" Launch diagnostic report.
Component: MATLAB Function | Category: Coder error
Computed maximum size of the output of function ‘colon’ is not bounded. Static memory allocation requires all sizes to be bounded. The computed size is [1 x :?]. More informationFunction ‘Control_Model/Current Controller ILR and PI/MATLAB Function’ (#24.2602.2630), line 87, column 24: "iR_NL_act:1:(iR_NL_act_plLL)" Launch diagnostic report.
Here is the corresponding code:
LL = 7;
assert (varyingInput_a <= 800)
assert (varyingInput_b <= 800)
varyingInput_a_plusLL = varyingInput_a+LL;
varyingInput_b_plusLL = varyingInput_b+LL;
assert (varyingInput_a_plusLL <= 800)
assert (varyingInput_b_plusLL <= 800)
iLrange_act(1:LL+1) = (varyingInput_a:1:(varyingInput_a_plusLL))-m;
iRrange_act(1:LL+1) = (varyingInput_b:1:(varyingInput_b_plusLL))-m;
I had the same problem before in the same Matlab function for an input variable from which the variables used here are calculated. There I also used the assert function and the error no longer occurred. I would have expected that using the function once before using the variable for the first time would be enough to limit all other variables derived/calculated from it.
Here is the code from the first assert use:
assert (N_act <= 800)
Angel4Nact = [1:1:N_act]*(2*pi/N_act);
varyingInput_a and varyingInput_b are calculated using N_actI am using a Matlab function in Simulink and want to create arrays whose size varies. However, I can specify the maximum size in advance. I got the following error message, although I am already using the assert function.
Computed maximum size of the output of function ‘colon’ is not bounded. Static memory allocation requires all sizes to be bounded. The computed size is [1 x :?]. More informationFunction ‘Control_Model/Current Controller ILR and PI/MATLAB Function’ (#24.2546.2574), line 86, column 24: "iL_NL_act:1:(iL_NL_act_plLL)" Launch diagnostic report.
Component: MATLAB Function | Category: Coder error
Computed maximum size of the output of function ‘colon’ is not bounded. Static memory allocation requires all sizes to be bounded. The computed size is [1 x :?]. More informationFunction ‘Control_Model/Current Controller ILR and PI/MATLAB Function’ (#24.2602.2630), line 87, column 24: "iR_NL_act:1:(iR_NL_act_plLL)" Launch diagnostic report.
Here is the corresponding code:
LL = 7;
assert (varyingInput_a <= 800)
assert (varyingInput_b <= 800)
varyingInput_a_plusLL = varyingInput_a+LL;
varyingInput_b_plusLL = varyingInput_b+LL;
assert (varyingInput_a_plusLL <= 800)
assert (varyingInput_b_plusLL <= 800)
iLrange_act(1:LL+1) = (varyingInput_a:1:(varyingInput_a_plusLL))-m;
iRrange_act(1:LL+1) = (varyingInput_b:1:(varyingInput_b_plusLL))-m;
I had the same problem before in the same Matlab function for an input variable from which the variables used here are calculated. There I also used the assert function and the error no longer occurred. I would have expected that using the function once before using the variable for the first time would be enough to limit all other variables derived/calculated from it.
Here is the code from the first assert use:
assert (N_act <= 800)
Angel4Nact = [1:1:N_act]*(2*pi/N_act);
varyingInput_a and varyingInput_b are calculated using N_act I am using a Matlab function in Simulink and want to create arrays whose size varies. However, I can specify the maximum size in advance. I got the following error message, although I am already using the assert function.
Computed maximum size of the output of function ‘colon’ is not bounded. Static memory allocation requires all sizes to be bounded. The computed size is [1 x :?]. More informationFunction ‘Control_Model/Current Controller ILR and PI/MATLAB Function’ (#24.2546.2574), line 86, column 24: "iL_NL_act:1:(iL_NL_act_plLL)" Launch diagnostic report.
Component: MATLAB Function | Category: Coder error
Computed maximum size of the output of function ‘colon’ is not bounded. Static memory allocation requires all sizes to be bounded. The computed size is [1 x :?]. More informationFunction ‘Control_Model/Current Controller ILR and PI/MATLAB Function’ (#24.2602.2630), line 87, column 24: "iR_NL_act:1:(iR_NL_act_plLL)" Launch diagnostic report.
Here is the corresponding code:
LL = 7;
assert (varyingInput_a <= 800)
assert (varyingInput_b <= 800)
varyingInput_a_plusLL = varyingInput_a+LL;
varyingInput_b_plusLL = varyingInput_b+LL;
assert (varyingInput_a_plusLL <= 800)
assert (varyingInput_b_plusLL <= 800)
iLrange_act(1:LL+1) = (varyingInput_a:1:(varyingInput_a_plusLL))-m;
iRrange_act(1:LL+1) = (varyingInput_b:1:(varyingInput_b_plusLL))-m;
I had the same problem before in the same Matlab function for an input variable from which the variables used here are calculated. There I also used the assert function and the error no longer occurred. I would have expected that using the function once before using the variable for the first time would be enough to limit all other variables derived/calculated from it.
Here is the code from the first assert use:
assert (N_act <= 800)
Angel4Nact = [1:1:N_act]*(2*pi/N_act);
varyingInput_a and varyingInput_b are calculated using N_act simulink, matlab function, coder error, size not bounded, assert, 2021a MATLAB Answers — New Questions