Email: helpdesk@telkomuniversity.ac.id

This Portal for internal use only!

  • My Download
  • Checkout
Application Package Repository Telkom University
All Categories

All Categories

  • IBM
  • Visual Paradigm
  • Adobe
  • Google
  • Matlab
  • Microsoft
    • Microsoft Apps
    • Analytics
    • AI + Machine Learning
    • Compute
    • Database
    • Developer Tools
    • Internet Of Things
    • Learning Services
    • Middleware System
    • Networking
    • Operating System
    • Productivity Tools
    • Security
    • VLS
      • Office
      • Windows
  • Opensource
  • Wordpress
    • Plugin WP
    • Themes WP
  • Others

Search

0 Wishlist

Cart

Categories
  • Microsoft
    • Microsoft Apps
    • Office
    • Operating System
    • VLS
    • Developer Tools
    • Productivity Tools
    • Database
    • AI + Machine Learning
    • Middleware System
    • Learning Services
    • Analytics
    • Networking
    • Compute
    • Security
    • Internet Of Things
  • Adobe
  • Matlab
  • Google
  • Visual Paradigm
  • WordPress
    • Plugin WP
    • Themes WP
  • Opensource
  • Others
More Categories Less Categories
  • Get Pack
    • Product Category
    • Simple Product
    • Grouped Product
    • Variable Product
    • External Product
  • My Account
    • Download
    • Cart
    • Checkout
    • Login
  • About Us
    • Contact
    • Forum
    • Frequently Questions
    • Privacy Policy
  • Forum
    • News
      • Category
      • News Tag

iconTicket Service Desk

  • My Download
  • Checkout
Application Package Repository Telkom University
All Categories

All Categories

  • IBM
  • Visual Paradigm
  • Adobe
  • Google
  • Matlab
  • Microsoft
    • Microsoft Apps
    • Analytics
    • AI + Machine Learning
    • Compute
    • Database
    • Developer Tools
    • Internet Of Things
    • Learning Services
    • Middleware System
    • Networking
    • Operating System
    • Productivity Tools
    • Security
    • VLS
      • Office
      • Windows
  • Opensource
  • Wordpress
    • Plugin WP
    • Themes WP
  • Others

Search

0 Wishlist

Cart

Menu
  • Home
    • Download Application Package Repository Telkom University
    • Application Package Repository Telkom University
    • Download Official License Telkom University
    • Download Installer Application Pack
    • Product Category
    • Simple Product
    • Grouped Product
    • Variable Product
    • External Product
  • All Pack
    • Microsoft
      • Operating System
      • Productivity Tools
      • Developer Tools
      • Database
      • AI + Machine Learning
      • Middleware System
      • Networking
      • Compute
      • Security
      • Analytics
      • Internet Of Things
      • Learning Services
    • Microsoft Apps
      • VLS
    • Adobe
    • Matlab
    • WordPress
      • Themes WP
      • Plugin WP
    • Google
    • Opensource
    • Others
  • My account
    • Download
    • Get Pack
    • Cart
    • Checkout
  • News
    • Category
    • News Tag
  • Forum
  • About Us
    • Privacy Policy
    • Frequently Questions
    • Contact
Home/Matlab

Category: Matlab

Category Archives: Matlab

Matlab News Blog From https://blogs.mathworks.com/

Non linear fitting and parametric optimization with genetic algorithm
Matlab News

Non linear fitting and parametric optimization with genetic algorithm

PuTI / 2025-01-31

I have a constitutive model with 4 parameters to fit to experimental stress vs strain data. Before implementing the GA, I tried lsqnonlin (with and without multistart), but one of the main problems is that the algorithm often tends to assign bound values to the optimised parameters. To the first parameter, which is larger than the others, it assigns the upper bound, to the second and third it assigns the lower bounds. Plotting the best individuals over time, it appears that the ga spans little between the solutions, and the optimisation seems to be biased towards the first parameter.
I am using the uniaxial model proposed by Dong, and have rechecked the correctness of the model form several times. Below is the main containing the ga and my error function. Any help is welcome, thank you

%CHANGE LINE 3 TO SELECT THE PATCH
%CHANGE LINES 9 AND 10 TO SELECT THE SPECIMEN
clc; clear all;close all;
load ("data_11122.mat"); % change lot number if necessary
clearvars -except data

%Model requires lambda= x/x0 instead of epsilon: calculate lambda
% from exp data and store in data struct

stress=data(6).stress; %change index to change dogbone if necessary
stress=stress/max(stress);
strain=data(6).strain; %change index to change dogbone if necessary
p_initial=[50 25 5 .5]*10e-3;
a0=[1 0 0];
%vincoli su zeta imposti da dong ( zeta tra 0 e 1 )
lb=[0 0 0 0]; %% AGGIUSTA UNITA DIN MISURA
ub=[650 98 35 1];

%ottimizzazione non lineare con metodo least square ( like Dong )
options = optimoptions(‘ga’, ‘Display’, ‘iter’, ‘PopulationSize’, 100, ‘MaxGenerations’, 200, ‘UseParallel’, true,’NonlinearConstraintAlgorithm’,’penalty’,’PlotFcn’,’gaplotbestindiv’,’InitialPopulationMatrix’,p_initial);
nvars=4;
[p_opt, fval, exitflag, output] = ga(@(p)(error_function(p, strain, stress)), nvars, [], [], [], [], lb, ub, [], options);

%check plot e ricostruzione del modello con i parametri ottimizzati
c = p_opt(1); % c
k1 = p_opt(2); % k1
k2 = p_opt(3); % k2
zeta = p_opt(4); % zeta
for i=1:length(strain)

sigma_calculated(i)=c*(strain(i)^2) + 2*strain(i)^2*k1*((strain(i)^2-1)*(i-zeta)^2*exp(k2*(strain(i)^2-1)^2*(1-zeta)^2));

end

% for i=1:length(strain)
% f = [strain(i) 0 0; %deformation gradient for each value of strain
% 0 1/sqrt(strain(i)) 0;
% 0 0 1/sqrt(strain(i))];
% C = f .* f’; % Calcola il tensore di Cauchy-Green
% prodot = a0 .* a0′;
% I4 = sum(sum(C .* prodot)); % calcolo invariante di C
% I = eye(3); % Matrice identità
%
% sigma= f*c*I*f’ + 2*f*(k1 * (1 – zeta)^2 * (I4 – 1) * (exp(k2 * ((1 – zeta) * (I4 – 1))^2)) * prodot)*f’;
%
% sigma_calculated(i)= sigma(1,1); %componente xx
% end

figure()
plot (strain,stress);
hold on
plot(strain, sigma_calculated,’r’);
legend (‘experimental’, ‘model’,’Location’, ‘northwest’);

function error = error_function(p,strain,stress)

sigma_calculated = zeros(length(strain), 1);

for i = 2:length(strain) %avoiding first value=0;

% f = [strain(i) 0 0; %deformation gradient
% 0 1/sqrt(strain(i)) 0;
% 0 0 1/sqrt(strain(i))];
% C = f .* f’; % tensore di Cauchy-Green
% prodot = a0 .* a0′;
% I4 = a0′ .* C .* a0; % calcolo IV invariante di C
% I = eye(3);
%
% sigma= f*p(1)*I*f’ + 2*f*(p(2) * (1 – p(4))^2 * (I4 – 1) * (exp(p(3) * ((1 – p(4)) * (I4 – 1))^2)) * prodot)*f’;
%
%
% sigma_calculated(i)= sigma(1,1); %componente xx
sigma_calculated(i)=p(1)*(strain(i)^2) + 2*strain(i)^2*p(2)*((strain(i)^2-1)*(i-p(4))^2*exp(p(3)*(strain(i)^2-1)^2*(1-p(4))^2));

end

error= sum((sigma_calculated-stress).^2) ; %/sum(stress).^2; % Somma dei quadrati delle differenze
%aggiungere normalizzazione rispetto allo stress( guardare script marta calcolo error )
endI have a constitutive model with 4 parameters to fit to experimental stress vs strain data. Before implementing the GA, I tried lsqnonlin (with and without multistart), but one of the main problems is that the algorithm often tends to assign bound values to the optimised parameters. To the first parameter, which is larger than the others, it assigns the upper bound, to the second and third it assigns the lower bounds. Plotting the best individuals over time, it appears that the ga spans little between the solutions, and the optimisation seems to be biased towards the first parameter.
I am using the uniaxial model proposed by Dong, and have rechecked the correctness of the model form several times. Below is the main containing the ga and my error function. Any help is welcome, thank you

%CHANGE LINE 3 TO SELECT THE PATCH
%CHANGE LINES 9 AND 10 TO SELECT THE SPECIMEN
clc; clear all;close all;
load ("data_11122.mat"); % change lot number if necessary
clearvars -except data

%Model requires lambda= x/x0 instead of epsilon: calculate lambda
% from exp data and store in data struct

stress=data(6).stress; %change index to change dogbone if necessary
stress=stress/max(stress);
strain=data(6).strain; %change index to change dogbone if necessary
p_initial=[50 25 5 .5]*10e-3;
a0=[1 0 0];
%vincoli su zeta imposti da dong ( zeta tra 0 e 1 )
lb=[0 0 0 0]; %% AGGIUSTA UNITA DIN MISURA
ub=[650 98 35 1];

%ottimizzazione non lineare con metodo least square ( like Dong )
options = optimoptions(‘ga’, ‘Display’, ‘iter’, ‘PopulationSize’, 100, ‘MaxGenerations’, 200, ‘UseParallel’, true,’NonlinearConstraintAlgorithm’,’penalty’,’PlotFcn’,’gaplotbestindiv’,’InitialPopulationMatrix’,p_initial);
nvars=4;
[p_opt, fval, exitflag, output] = ga(@(p)(error_function(p, strain, stress)), nvars, [], [], [], [], lb, ub, [], options);

%check plot e ricostruzione del modello con i parametri ottimizzati
c = p_opt(1); % c
k1 = p_opt(2); % k1
k2 = p_opt(3); % k2
zeta = p_opt(4); % zeta
for i=1:length(strain)

sigma_calculated(i)=c*(strain(i)^2) + 2*strain(i)^2*k1*((strain(i)^2-1)*(i-zeta)^2*exp(k2*(strain(i)^2-1)^2*(1-zeta)^2));

end

% for i=1:length(strain)
% f = [strain(i) 0 0; %deformation gradient for each value of strain
% 0 1/sqrt(strain(i)) 0;
% 0 0 1/sqrt(strain(i))];
% C = f .* f’; % Calcola il tensore di Cauchy-Green
% prodot = a0 .* a0′;
% I4 = sum(sum(C .* prodot)); % calcolo invariante di C
% I = eye(3); % Matrice identità
%
% sigma= f*c*I*f’ + 2*f*(k1 * (1 – zeta)^2 * (I4 – 1) * (exp(k2 * ((1 – zeta) * (I4 – 1))^2)) * prodot)*f’;
%
% sigma_calculated(i)= sigma(1,1); %componente xx
% end

figure()
plot (strain,stress);
hold on
plot(strain, sigma_calculated,’r’);
legend (‘experimental’, ‘model’,’Location’, ‘northwest’);

function error = error_function(p,strain,stress)

sigma_calculated = zeros(length(strain), 1);

for i = 2:length(strain) %avoiding first value=0;

% f = [strain(i) 0 0; %deformation gradient
% 0 1/sqrt(strain(i)) 0;
% 0 0 1/sqrt(strain(i))];
% C = f .* f’; % tensore di Cauchy-Green
% prodot = a0 .* a0′;
% I4 = a0′ .* C .* a0; % calcolo IV invariante di C
% I = eye(3);
%
% sigma= f*p(1)*I*f’ + 2*f*(p(2) * (1 – p(4))^2 * (I4 – 1) * (exp(p(3) * ((1 – p(4)) * (I4 – 1))^2)) * prodot)*f’;
%
%
% sigma_calculated(i)= sigma(1,1); %componente xx
sigma_calculated(i)=p(1)*(strain(i)^2) + 2*strain(i)^2*p(2)*((strain(i)^2-1)*(i-p(4))^2*exp(p(3)*(strain(i)^2-1)^2*(1-p(4))^2));

end

error= sum((sigma_calculated-stress).^2) ; %/sum(stress).^2; % Somma dei quadrati delle differenze
%aggiungere normalizzazione rispetto allo stress( guardare script marta calcolo error )
end I have a constitutive model with 4 parameters to fit to experimental stress vs strain data. Before implementing the GA, I tried lsqnonlin (with and without multistart), but one of the main problems is that the algorithm often tends to assign bound values to the optimised parameters. To the first parameter, which is larger than the others, it assigns the upper bound, to the second and third it assigns the lower bounds. Plotting the best individuals over time, it appears that the ga spans little between the solutions, and the optimisation seems to be biased towards the first parameter.
I am using the uniaxial model proposed by Dong, and have rechecked the correctness of the model form several times. Below is the main containing the ga and my error function. Any help is welcome, thank you

%CHANGE LINE 3 TO SELECT THE PATCH
%CHANGE LINES 9 AND 10 TO SELECT THE SPECIMEN
clc; clear all;close all;
load ("data_11122.mat"); % change lot number if necessary
clearvars -except data

%Model requires lambda= x/x0 instead of epsilon: calculate lambda
% from exp data and store in data struct

stress=data(6).stress; %change index to change dogbone if necessary
stress=stress/max(stress);
strain=data(6).strain; %change index to change dogbone if necessary
p_initial=[50 25 5 .5]*10e-3;
a0=[1 0 0];
%vincoli su zeta imposti da dong ( zeta tra 0 e 1 )
lb=[0 0 0 0]; %% AGGIUSTA UNITA DIN MISURA
ub=[650 98 35 1];

%ottimizzazione non lineare con metodo least square ( like Dong )
options = optimoptions(‘ga’, ‘Display’, ‘iter’, ‘PopulationSize’, 100, ‘MaxGenerations’, 200, ‘UseParallel’, true,’NonlinearConstraintAlgorithm’,’penalty’,’PlotFcn’,’gaplotbestindiv’,’InitialPopulationMatrix’,p_initial);
nvars=4;
[p_opt, fval, exitflag, output] = ga(@(p)(error_function(p, strain, stress)), nvars, [], [], [], [], lb, ub, [], options);

%check plot e ricostruzione del modello con i parametri ottimizzati
c = p_opt(1); % c
k1 = p_opt(2); % k1
k2 = p_opt(3); % k2
zeta = p_opt(4); % zeta
for i=1:length(strain)

sigma_calculated(i)=c*(strain(i)^2) + 2*strain(i)^2*k1*((strain(i)^2-1)*(i-zeta)^2*exp(k2*(strain(i)^2-1)^2*(1-zeta)^2));

end

% for i=1:length(strain)
% f = [strain(i) 0 0; %deformation gradient for each value of strain
% 0 1/sqrt(strain(i)) 0;
% 0 0 1/sqrt(strain(i))];
% C = f .* f’; % Calcola il tensore di Cauchy-Green
% prodot = a0 .* a0′;
% I4 = sum(sum(C .* prodot)); % calcolo invariante di C
% I = eye(3); % Matrice identità
%
% sigma= f*c*I*f’ + 2*f*(k1 * (1 – zeta)^2 * (I4 – 1) * (exp(k2 * ((1 – zeta) * (I4 – 1))^2)) * prodot)*f’;
%
% sigma_calculated(i)= sigma(1,1); %componente xx
% end

figure()
plot (strain,stress);
hold on
plot(strain, sigma_calculated,’r’);
legend (‘experimental’, ‘model’,’Location’, ‘northwest’);

function error = error_function(p,strain,stress)

sigma_calculated = zeros(length(strain), 1);

for i = 2:length(strain) %avoiding first value=0;

% f = [strain(i) 0 0; %deformation gradient
% 0 1/sqrt(strain(i)) 0;
% 0 0 1/sqrt(strain(i))];
% C = f .* f’; % tensore di Cauchy-Green
% prodot = a0 .* a0′;
% I4 = a0′ .* C .* a0; % calcolo IV invariante di C
% I = eye(3);
%
% sigma= f*p(1)*I*f’ + 2*f*(p(2) * (1 – p(4))^2 * (I4 – 1) * (exp(p(3) * ((1 – p(4)) * (I4 – 1))^2)) * prodot)*f’;
%
%
% sigma_calculated(i)= sigma(1,1); %componente xx
sigma_calculated(i)=p(1)*(strain(i)^2) + 2*strain(i)^2*p(2)*((strain(i)^2-1)*(i-p(4))^2*exp(p(3)*(strain(i)^2-1)^2*(1-p(4))^2));

end

error= sum((sigma_calculated-stress).^2) ; %/sum(stress).^2; % Somma dei quadrati delle differenze
%aggiungere normalizzazione rispetto allo stress( guardare script marta calcolo error )
end ga, optimization, nonlinear, curve fitting MATLAB Answers — New Questions

​

Creating a three-phase UPS in MATLAB
Matlab News

Creating a three-phase UPS in MATLAB

PuTI / 2025-01-31

I am having a problem trying to create a Three-phase UPS in MATLAB, I do have an existing file whereby the system works as a single phase. I have then multiplied the system by three and connected it to a load at the output however the output seems to flatline and then rise again, could I get some help on this.

Kind Regards,I am having a problem trying to create a Three-phase UPS in MATLAB, I do have an existing file whereby the system works as a single phase. I have then multiplied the system by three and connected it to a load at the output however the output seems to flatline and then rise again, could I get some help on this.

Kind Regards, I am having a problem trying to create a Three-phase UPS in MATLAB, I do have an existing file whereby the system works as a single phase. I have then multiplied the system by three and connected it to a load at the output however the output seems to flatline and then rise again, could I get some help on this.

Kind Regards, power_conversion_control, ups, three-phase MATLAB Answers — New Questions

​

geoplot3 for subsurface lines
Matlab News

geoplot3 for subsurface lines

PuTI / 2025-01-31

Dear community,
I fing the geoglobe and geoplot3 functions reallly nice and powerful, yet I have been trying to plot a simple case without succeeding.
I want to plot lines that are located below the surface (underground tunnels, wells, etc.). Is there a workaround to play with the ground layer "transparency" to see those lines that are drawn efectively below, but hidden by the surface?
An extract of the code I’m using:
uif = uifigure;
lat=[43.93365285 43.94086810];
lon=[5.48483510 5.48376465];
alt=[483.591 499.640];
g = geoglobe(uif,’Basemap’,’satellite’,"Terrain","gmted2010");
geoplot3(g,lat,lon,alt,’r’,"LineWidth",2)
campos(g,43.912,5.465,700);
campitch(g,0)
camheading(g,20)
Thanks a lot in advance.Dear community,
I fing the geoglobe and geoplot3 functions reallly nice and powerful, yet I have been trying to plot a simple case without succeeding.
I want to plot lines that are located below the surface (underground tunnels, wells, etc.). Is there a workaround to play with the ground layer "transparency" to see those lines that are drawn efectively below, but hidden by the surface?
An extract of the code I’m using:
uif = uifigure;
lat=[43.93365285 43.94086810];
lon=[5.48483510 5.48376465];
alt=[483.591 499.640];
g = geoglobe(uif,’Basemap’,’satellite’,"Terrain","gmted2010");
geoplot3(g,lat,lon,alt,’r’,"LineWidth",2)
campos(g,43.912,5.465,700);
campitch(g,0)
camheading(g,20)
Thanks a lot in advance. Dear community,
I fing the geoglobe and geoplot3 functions reallly nice and powerful, yet I have been trying to plot a simple case without succeeding.
I want to plot lines that are located below the surface (underground tunnels, wells, etc.). Is there a workaround to play with the ground layer "transparency" to see those lines that are drawn efectively below, but hidden by the surface?
An extract of the code I’m using:
uif = uifigure;
lat=[43.93365285 43.94086810];
lon=[5.48483510 5.48376465];
alt=[483.591 499.640];
g = geoglobe(uif,’Basemap’,’satellite’,"Terrain","gmted2010");
geoplot3(g,lat,lon,alt,’r’,"LineWidth",2)
campos(g,43.912,5.465,700);
campitch(g,0)
camheading(g,20)
Thanks a lot in advance. geoplot3 MATLAB Answers — New Questions

​

Can I use the same test cases for both a fixed-point and floating-point model in Simulink Test?
Matlab News

Can I use the same test cases for both a fixed-point and floating-point model in Simulink Test?

PuTI / 2025-01-31

I am doing model-in-loop (normal simulation) and software-in-loop testing on my models (codegen). Previously, I have been working with floating-point models and am now moving to work with fixed-point models. I am interested in knowing how Simulink Test supports signal and parameter scaling for fixed-point models in SIL workflows, and whether I need to provide parameter scaling and offsets for floating-point to fixed-point conversion of model inputs and outputs. I am familiar with using A2L files to do parameter scaling and offsets for fixed-point data conversion when running tests at the test bench with SIL workflows with other test tools. The input stimulus and expected outputs for my tests are pulled from an external Excel file.
When Simulink Test is used to manage test cases with an external Excel file to provide the input stimulus and expected outputs, and to manage parameter override, all signals and parameters are also in engineering units. This works OK with MIL testing since model is also in the engineering domain. However, the generated code is in integer world, and the SIL simulation takes integer values for inputs and outputs. What can be done in Simulink Test and/or the Excel file so the same test cases can be re-used for both MIL and SIL? Simulink Test should play the role of the Calibration/Test tool and somehow allow the user to specify the scaling and offset so as to unify both worlds."I am doing model-in-loop (normal simulation) and software-in-loop testing on my models (codegen). Previously, I have been working with floating-point models and am now moving to work with fixed-point models. I am interested in knowing how Simulink Test supports signal and parameter scaling for fixed-point models in SIL workflows, and whether I need to provide parameter scaling and offsets for floating-point to fixed-point conversion of model inputs and outputs. I am familiar with using A2L files to do parameter scaling and offsets for fixed-point data conversion when running tests at the test bench with SIL workflows with other test tools. The input stimulus and expected outputs for my tests are pulled from an external Excel file.
When Simulink Test is used to manage test cases with an external Excel file to provide the input stimulus and expected outputs, and to manage parameter override, all signals and parameters are also in engineering units. This works OK with MIL testing since model is also in the engineering domain. However, the generated code is in integer world, and the SIL simulation takes integer values for inputs and outputs. What can be done in Simulink Test and/or the Excel file so the same test cases can be re-used for both MIL and SIL? Simulink Test should play the role of the Calibration/Test tool and somehow allow the user to specify the scaling and offset so as to unify both worlds." I am doing model-in-loop (normal simulation) and software-in-loop testing on my models (codegen). Previously, I have been working with floating-point models and am now moving to work with fixed-point models. I am interested in knowing how Simulink Test supports signal and parameter scaling for fixed-point models in SIL workflows, and whether I need to provide parameter scaling and offsets for floating-point to fixed-point conversion of model inputs and outputs. I am familiar with using A2L files to do parameter scaling and offsets for fixed-point data conversion when running tests at the test bench with SIL workflows with other test tools. The input stimulus and expected outputs for my tests are pulled from an external Excel file.
When Simulink Test is used to manage test cases with an external Excel file to provide the input stimulus and expected outputs, and to manage parameter override, all signals and parameters are also in engineering units. This works OK with MIL testing since model is also in the engineering domain. However, the generated code is in integer world, and the SIL simulation takes integer values for inputs and outputs. What can be done in Simulink Test and/or the Excel file so the same test cases can be re-used for both MIL and SIL? Simulink Test should play the role of the Calibration/Test tool and somehow allow the user to specify the scaling and offset so as to unify both worlds." sil, mil MATLAB Answers — New Questions

​

Alias blanks in the cell array as a string.
Matlab News

Alias blanks in the cell array as a string.

PuTI / 2025-01-31

I am using the ‘importdata’ function to read a text file. It reads the numeric data as a matrix and text data as a cell array; now the first element of cell array is all the headers, I use a ‘strsplit’ function to separate each individual variable name in header. The issue is that there are some blank columns in the text file, so the numeric matrix reads it as a ‘NaN’ but the resulting variables (which I used ‘strsplit’ for) eliminates blanks. Now the result is that size(textdata,2) +size(data,2) is not equal to size(variable,2). I want to read blanks in the header as a variable, alias it as ‘empty’I am using the ‘importdata’ function to read a text file. It reads the numeric data as a matrix and text data as a cell array; now the first element of cell array is all the headers, I use a ‘strsplit’ function to separate each individual variable name in header. The issue is that there are some blank columns in the text file, so the numeric matrix reads it as a ‘NaN’ but the resulting variables (which I used ‘strsplit’ for) eliminates blanks. Now the result is that size(textdata,2) +size(data,2) is not equal to size(variable,2). I want to read blanks in the header as a variable, alias it as ‘empty’ I am using the ‘importdata’ function to read a text file. It reads the numeric data as a matrix and text data as a cell array; now the first element of cell array is all the headers, I use a ‘strsplit’ function to separate each individual variable name in header. The issue is that there are some blank columns in the text file, so the numeric matrix reads it as a ‘NaN’ but the resulting variables (which I used ‘strsplit’ for) eliminates blanks. Now the result is that size(textdata,2) +size(data,2) is not equal to size(variable,2). I want to read blanks in the header as a variable, alias it as ‘empty’ textscan, imporatdata, strsplit MATLAB Answers — New Questions

​

Multiply a cell with a scalar number
Matlab News

Multiply a cell with a scalar number

PuTI / 2025-01-31

Hello all, i have a problem in multiply my cell in Matlab. I have 1×5218 cell wich i want to multiply it with a scalar number. First, i used code like this,
t = readtable(‘100Hz.csv’);
input = t.x10000(1:5218);
new_input = input.*2;
it return,
Undefined operator ‘.*’ for input arguments of type ‘cell’.

Error in FFT_Matlab (line 3)
new_input = Input.*2;
how i solve this problem ? Thank youHello all, i have a problem in multiply my cell in Matlab. I have 1×5218 cell wich i want to multiply it with a scalar number. First, i used code like this,
t = readtable(‘100Hz.csv’);
input = t.x10000(1:5218);
new_input = input.*2;
it return,
Undefined operator ‘.*’ for input arguments of type ‘cell’.

Error in FFT_Matlab (line 3)
new_input = Input.*2;
how i solve this problem ? Thank you Hello all, i have a problem in multiply my cell in Matlab. I have 1×5218 cell wich i want to multiply it with a scalar number. First, i used code like this,
t = readtable(‘100Hz.csv’);
input = t.x10000(1:5218);
new_input = input.*2;
it return,
Undefined operator ‘.*’ for input arguments of type ‘cell’.

Error in FFT_Matlab (line 3)
new_input = Input.*2;
how i solve this problem ? Thank you csv, cell, tab, matlab MATLAB Answers — New Questions

​

What encoding is used by the file I/O functions such as ‘fileread’?
Matlab News

What encoding is used by the file I/O functions such as ‘fileread’?

PuTI / 2025-01-31

I am using the "fileread" function to read a text file. What encoding is used when reading this file?I am using the "fileread" function to read a text file. What encoding is used when reading this file? I am using the "fileread" function to read a text file. What encoding is used when reading this file? file, i/o, fileread, fopen MATLAB Answers — New Questions

​

How to set different solvers for multiple sub-models in Simulink?
Matlab News

How to set different solvers for multiple sub-models in Simulink?

PuTI / 2025-01-31

How to set different solvers for multiple sub-models in Simulink (Not Simscape)? Or in other words, how to set different solvers for "top" model and "child" models in Simulink?How to set different solvers for multiple sub-models in Simulink (Not Simscape)? Or in other words, how to set different solvers for "top" model and "child" models in Simulink? How to set different solvers for multiple sub-models in Simulink (Not Simscape)? Or in other words, how to set different solvers for "top" model and "child" models in Simulink?  MATLAB Answers — New Questions

​

Why is a password asked in Git Source Control when there is an SSH key?
Matlab News

Why is a password asked in Git Source Control when there is an SSH key?

PuTI / 2025-01-31

I have a Git repository, and when I try to use Source Control integration in MATLAB, it always asks for a password. I have installed the ssh keys, and those work fine in Git for Windows terminal. The keys are placed in the correct location. I have the correct "HOME" environment variable. The output of command "git config –list":

diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean — %f
filter.lfs.smudge=git-lfs smudge — %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
http.sslbackend=openssl
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
core.autocrlf=true
core.fscache=true
core.symlinks=false
credential.helper=manager
user.name=****************
user.email=****************core.symlinks=false
core.repositoryformatversion=0
core.filemode=false
core.logallrefupdates=trueremote.origin.url=http://****************.com/test/matlab.gitremote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
How to get rid of the password prompt?I have a Git repository, and when I try to use Source Control integration in MATLAB, it always asks for a password. I have installed the ssh keys, and those work fine in Git for Windows terminal. The keys are placed in the correct location. I have the correct "HOME" environment variable. The output of command "git config –list":

diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean — %f
filter.lfs.smudge=git-lfs smudge — %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
http.sslbackend=openssl
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
core.autocrlf=true
core.fscache=true
core.symlinks=false
credential.helper=manager
user.name=****************
user.email=****************core.symlinks=false
core.repositoryformatversion=0
core.filemode=false
core.logallrefupdates=trueremote.origin.url=http://****************.com/test/matlab.gitremote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
How to get rid of the password prompt? I have a Git repository, and when I try to use Source Control integration in MATLAB, it always asks for a password. I have installed the ssh keys, and those work fine in Git for Windows terminal. The keys are placed in the correct location. I have the correct "HOME" environment variable. The output of command "git config –list":

diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean — %f
filter.lfs.smudge=git-lfs smudge — %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
http.sslbackend=openssl
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
core.autocrlf=true
core.fscache=true
core.symlinks=false
credential.helper=manager
user.name=****************
user.email=****************core.symlinks=false
core.repositoryformatversion=0
core.filemode=false
core.logallrefupdates=trueremote.origin.url=http://****************.com/test/matlab.gitremote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
How to get rid of the password prompt? git, repository, source, control, integration, ssh, password, http MATLAB Answers — New Questions

​

Why is my ROS node running slower than expected when deployed?
Matlab News

Why is my ROS node running slower than expected when deployed?

PuTI / 2025-01-31

I am generating a ROS node from a Simulink model and deploying to an embedded computer. My model includes ROS Publisher/Subscriber blocks within an enabled subsystem, so that my algorithm only runs when a message is received. When I set the sample time in Solver Parameters to 200 Hz, and then inherit this sample time in my Subscriber block, I can only achieve performance of 30 Hz upon deployment. Why is this the case and how can I improve performance?I am generating a ROS node from a Simulink model and deploying to an embedded computer. My model includes ROS Publisher/Subscriber blocks within an enabled subsystem, so that my algorithm only runs when a message is received. When I set the sample time in Solver Parameters to 200 Hz, and then inherit this sample time in my Subscriber block, I can only achieve performance of 30 Hz upon deployment. Why is this the case and how can I improve performance? I am generating a ROS node from a Simulink model and deploying to an embedded computer. My model includes ROS Publisher/Subscriber blocks within an enabled subsystem, so that my algorithm only runs when a message is received. When I set the sample time in Solver Parameters to 200 Hz, and then inherit this sample time in my Subscriber block, I can only achieve performance of 30 Hz upon deployment. Why is this the case and how can I improve performance?  MATLAB Answers — New Questions

​

How to deploy deep learning networks for Hardware-in-the-Loop (HIL) simulation with, for example, Speedgoat or dSPACE hardware systems from MATLAB R2018b onward?
Matlab News

How to deploy deep learning networks for Hardware-in-the-Loop (HIL) simulation with, for example, Speedgoat or dSPACE hardware systems from MATLAB R2018b onward?

PuTI / 2025-01-31

I want to generate plain code out of my keras deep learning neuronal network to avoid the dependency of third-party libs. I do this in MATLAB R2021a.
After that, I would like to build an S-Function for the use inside a model in MATLAB R2017b for deployment in HIL, which is set up in MATLAB R2017b. What is the recommended workflow?I want to generate plain code out of my keras deep learning neuronal network to avoid the dependency of third-party libs. I do this in MATLAB R2021a.
After that, I would like to build an S-Function for the use inside a model in MATLAB R2017b for deployment in HIL, which is set up in MATLAB R2017b. What is the recommended workflow? I want to generate plain code out of my keras deep learning neuronal network to avoid the dependency of third-party libs. I do this in MATLAB R2021a.
After that, I would like to build an S-Function for the use inside a model in MATLAB R2017b for deployment in HIL, which is set up in MATLAB R2017b. What is the recommended workflow?  MATLAB Answers — New Questions

​

ismatlab function within pop_loadbv not working
Matlab News

ismatlab function within pop_loadbv not working

PuTI / 2025-01-31

I am trying to load some EEG data into matlab using this code:
ampmatrix = nan(totalN, length(triggerlabels));
SNRdb_matrix = nan(totalN, length(triggerlabels));
for PNo = 1:totalN % loop to iterate through each EEG data file

[EEG, com] = pop_loadbv(‘C:UsersGeorgOneDrive – University of XXXEEG_data’, files(PNo).name);
(with my actual onedrive not XXX)
and I am getting this error message:
Unrecognized function or variable ‘ismatlab’.

Error in pop_loadbv (line 146)
if ismatlab
^^^^^^^^
I am really stuck! I have tried downloading and setting a path to the bva-io package but it is not working. My EEG folder contains three files for each participants (.eeg, .vhdr and .vmrk) and also has a path set to it. Can anyone help me please?I am trying to load some EEG data into matlab using this code:
ampmatrix = nan(totalN, length(triggerlabels));
SNRdb_matrix = nan(totalN, length(triggerlabels));
for PNo = 1:totalN % loop to iterate through each EEG data file

[EEG, com] = pop_loadbv(‘C:UsersGeorgOneDrive – University of XXXEEG_data’, files(PNo).name);
(with my actual onedrive not XXX)
and I am getting this error message:
Unrecognized function or variable ‘ismatlab’.

Error in pop_loadbv (line 146)
if ismatlab
^^^^^^^^
I am really stuck! I have tried downloading and setting a path to the bva-io package but it is not working. My EEG folder contains three files for each participants (.eeg, .vhdr and .vmrk) and also has a path set to it. Can anyone help me please? I am trying to load some EEG data into matlab using this code:
ampmatrix = nan(totalN, length(triggerlabels));
SNRdb_matrix = nan(totalN, length(triggerlabels));
for PNo = 1:totalN % loop to iterate through each EEG data file

[EEG, com] = pop_loadbv(‘C:UsersGeorgOneDrive – University of XXXEEG_data’, files(PNo).name);
(with my actual onedrive not XXX)
and I am getting this error message:
Unrecognized function or variable ‘ismatlab’.

Error in pop_loadbv (line 146)
if ismatlab
^^^^^^^^
I am really stuck! I have tried downloading and setting a path to the bva-io package but it is not working. My EEG folder contains three files for each participants (.eeg, .vhdr and .vmrk) and also has a path set to it. Can anyone help me please? eeg, pop_loadbv MATLAB Answers — New Questions

​

Tiled layout with a nested graph spanning multiple tiles
Matlab News

Tiled layout with a nested graph spanning multiple tiles

PuTI / 2025-01-31

I would like to nest/superimpose a plot on another, which is part of a tiledlayout and spans multiple tiles. The following works fine:
figure
tiledlayout(1, 6)

nexttile([1 5])
plot(1:10)

nexttile(6)
plot(11:20)
However, the following does not and it results in two figures:
figure
tiledlayout(1, 6)

nexttile([1 5])
plot(1:10)

axes("position", [0.5 0.5 0.2 0.2])
plot(21:30)

nexttile(6)
plot(11:20)I would like to nest/superimpose a plot on another, which is part of a tiledlayout and spans multiple tiles. The following works fine:
figure
tiledlayout(1, 6)

nexttile([1 5])
plot(1:10)

nexttile(6)
plot(11:20)
However, the following does not and it results in two figures:
figure
tiledlayout(1, 6)

nexttile([1 5])
plot(1:10)

axes("position", [0.5 0.5 0.2 0.2])
plot(21:30)

nexttile(6)
plot(11:20) I would like to nest/superimpose a plot on another, which is part of a tiledlayout and spans multiple tiles. The following works fine:
figure
tiledlayout(1, 6)

nexttile([1 5])
plot(1:10)

nexttile(6)
plot(11:20)
However, the following does not and it results in two figures:
figure
tiledlayout(1, 6)

nexttile([1 5])
plot(1:10)

axes("position", [0.5 0.5 0.2 0.2])
plot(21:30)

nexttile(6)
plot(11:20) plotting, tiledlayout, axes, tile MATLAB Answers — New Questions

​

Programmatically add toolbox within MATLAB docker container.
Matlab News

Programmatically add toolbox within MATLAB docker container.

PuTI / 2025-01-31

A MATLAB script is running in the cloud as a docker container.
Steps that I would like the script to do:
Fetch a .mltbx file from a REST API.
Remove previously installed toolboxes
Install new toolbox .
Run a function from this toolbox.
For step 2 and 3 I am using these functions.
‘matlab.addons.toolbox.installedToolboxes’
‘matlab.addons.toolbox.uninstallToolbox(toolbox)’
‘matlab.addons.toolbox.installToolbox(toolbox)’
This works when I run the script locally but when I package it as a docker container using MATLAB compiler and ran it in the cloud the following error is thrown for the installedToolboxes function.
Unable to resolve the name ‘matlab.addons.toolbox.installedToolboxes’.
‘matlab.addons.toolbox.installedToolboxes’ was excluded from packaging for the MATLAB Runtime environment according to the MATLAB Compiler license.
Have the application owner either resolve the file or function from the code, or use the MATLAB function "isdeployed" to ensure the function is not invoked.
Contact the application owner for more details.

MATLAB:undefinedVarOrClass
I also tried to unzip the .mltbx file and copy the .m files to an existing path that is already present in the searchpath. That works but executing the .m file throws the following error:
Previously accessible file "/home/appuser/.MathWorks/MatlabRuntimeCache/R2024b/modelB0/modelBatch/FlowQ.m" is now inaccessible. │
│
Error in fetchAndInstallToolbox (line 41) │
│
Error in modelBatch (line 40) │
│
MATLAB:fileHasDisappeared
I understand that since R2019a, functions that modify the MATLAB search path are unsupported when using MATLAB Compiler. Both things that I tried modify the MATLAB runtime environment in the docker image, so I guess it is normal that these don’t work.
Is there a way to get around this? Is it possible to dynamically add new classes and functions to a docker container?A MATLAB script is running in the cloud as a docker container.
Steps that I would like the script to do:
Fetch a .mltbx file from a REST API.
Remove previously installed toolboxes
Install new toolbox .
Run a function from this toolbox.
For step 2 and 3 I am using these functions.
‘matlab.addons.toolbox.installedToolboxes’
‘matlab.addons.toolbox.uninstallToolbox(toolbox)’
‘matlab.addons.toolbox.installToolbox(toolbox)’
This works when I run the script locally but when I package it as a docker container using MATLAB compiler and ran it in the cloud the following error is thrown for the installedToolboxes function.
Unable to resolve the name ‘matlab.addons.toolbox.installedToolboxes’.
‘matlab.addons.toolbox.installedToolboxes’ was excluded from packaging for the MATLAB Runtime environment according to the MATLAB Compiler license.
Have the application owner either resolve the file or function from the code, or use the MATLAB function "isdeployed" to ensure the function is not invoked.
Contact the application owner for more details.

MATLAB:undefinedVarOrClass
I also tried to unzip the .mltbx file and copy the .m files to an existing path that is already present in the searchpath. That works but executing the .m file throws the following error:
Previously accessible file "/home/appuser/.MathWorks/MatlabRuntimeCache/R2024b/modelB0/modelBatch/FlowQ.m" is now inaccessible. │
│
Error in fetchAndInstallToolbox (line 41) │
│
Error in modelBatch (line 40) │
│
MATLAB:fileHasDisappeared
I understand that since R2019a, functions that modify the MATLAB search path are unsupported when using MATLAB Compiler. Both things that I tried modify the MATLAB runtime environment in the docker image, so I guess it is normal that these don’t work.
Is there a way to get around this? Is it possible to dynamically add new classes and functions to a docker container? A MATLAB script is running in the cloud as a docker container.
Steps that I would like the script to do:
Fetch a .mltbx file from a REST API.
Remove previously installed toolboxes
Install new toolbox .
Run a function from this toolbox.
For step 2 and 3 I am using these functions.
‘matlab.addons.toolbox.installedToolboxes’
‘matlab.addons.toolbox.uninstallToolbox(toolbox)’
‘matlab.addons.toolbox.installToolbox(toolbox)’
This works when I run the script locally but when I package it as a docker container using MATLAB compiler and ran it in the cloud the following error is thrown for the installedToolboxes function.
Unable to resolve the name ‘matlab.addons.toolbox.installedToolboxes’.
‘matlab.addons.toolbox.installedToolboxes’ was excluded from packaging for the MATLAB Runtime environment according to the MATLAB Compiler license.
Have the application owner either resolve the file or function from the code, or use the MATLAB function "isdeployed" to ensure the function is not invoked.
Contact the application owner for more details.

MATLAB:undefinedVarOrClass
I also tried to unzip the .mltbx file and copy the .m files to an existing path that is already present in the searchpath. That works but executing the .m file throws the following error:
Previously accessible file "/home/appuser/.MathWorks/MatlabRuntimeCache/R2024b/modelB0/modelBatch/FlowQ.m" is now inaccessible. │
│
Error in fetchAndInstallToolbox (line 41) │
│
Error in modelBatch (line 40) │
│
MATLAB:fileHasDisappeared
I understand that since R2019a, functions that modify the MATLAB search path are unsupported when using MATLAB Compiler. Both things that I tried modify the MATLAB runtime environment in the docker image, so I guess it is normal that these don’t work.
Is there a way to get around this? Is it possible to dynamically add new classes and functions to a docker container? matlab compiler, toolbox, addons MATLAB Answers — New Questions

​

Number of arithmetic operations in Simulink model
Matlab News

Number of arithmetic operations in Simulink model

PuTI / 2025-01-31

Is it possible to count the number of multiplications and additions in Simulink model?Is it possible to count the number of multiplications and additions in Simulink model? Is it possible to count the number of multiplications and additions in Simulink model? number of multiplications and additions MATLAB Answers — New Questions

​

MATLAB in Python problems
Matlab News

MATLAB in Python problems

PuTI / 2025-01-31

Recently I came to learn python to use it in MATLAB from a learn python tutorial. The figure turned off automatically after it showed up. Can anyone tell me whats the probable reason for this?
I wrote a simple code through cmd in windows:
import matlab.engine
eng=matlab.engine.start_matlab()
eng.plot(1.0,2.0,nargout=0)
It works well.
But I wrote exactly the same code in pycharm, the figure turned off automatically after it showed up.Recently I came to learn python to use it in MATLAB from a learn python tutorial. The figure turned off automatically after it showed up. Can anyone tell me whats the probable reason for this?
I wrote a simple code through cmd in windows:
import matlab.engine
eng=matlab.engine.start_matlab()
eng.plot(1.0,2.0,nargout=0)
It works well.
But I wrote exactly the same code in pycharm, the figure turned off automatically after it showed up. Recently I came to learn python to use it in MATLAB from a learn python tutorial. The figure turned off automatically after it showed up. Can anyone tell me whats the probable reason for this?
I wrote a simple code through cmd in windows:
import matlab.engine
eng=matlab.engine.start_matlab()
eng.plot(1.0,2.0,nargout=0)
It works well.
But I wrote exactly the same code in pycharm, the figure turned off automatically after it showed up. python, coding MATLAB Answers — New Questions

​

How to click and sort a header in uiTable?
Matlab News

How to click and sort a header in uiTable?

PuTI / 2025-01-31

I would like to sort the columns in a table by clicking on the column header I want to sort.
Is there a way to click/select the headers and sort the column in uitable?I would like to sort the columns in a table by clicking on the column header I want to sort.
Is there a way to click/select the headers and sort the column in uitable? I would like to sort the columns in a table by clicking on the column header I want to sort.
Is there a way to click/select the headers and sort the column in uitable? uitable, sort MATLAB Answers — New Questions

​

How to create simulink Data dictionary by using a command in a matlab script ?
Matlab News

How to create simulink Data dictionary by using a command in a matlab script ?

PuTI / 2025-01-31

I have a Simulink Model block with some entries and outputs.Each Input and output has its Data types.
Apart from this i have an array where in one column i have all the input and output names and on one side i have its corresponding data types (all stored in an array).
From only these data how do i create a simulink data dictionary . How do i choose only this section from the array and create a data dictionary out of it .
For example : ‘MyDataDictionary.sldd’ containing a column named ‘Names’ and the next column named ‘DataTypes’ and all these saved in an sldd format 5all inside amatlab script) .
I want it like an automated script without going into simulink model explorer and then getting the data dictionary.
Any help will be appreciated .I have a Simulink Model block with some entries and outputs.Each Input and output has its Data types.
Apart from this i have an array where in one column i have all the input and output names and on one side i have its corresponding data types (all stored in an array).
From only these data how do i create a simulink data dictionary . How do i choose only this section from the array and create a data dictionary out of it .
For example : ‘MyDataDictionary.sldd’ containing a column named ‘Names’ and the next column named ‘DataTypes’ and all these saved in an sldd format 5all inside amatlab script) .
I want it like an automated script without going into simulink model explorer and then getting the data dictionary.
Any help will be appreciated . I have a Simulink Model block with some entries and outputs.Each Input and output has its Data types.
Apart from this i have an array where in one column i have all the input and output names and on one side i have its corresponding data types (all stored in an array).
From only these data how do i create a simulink data dictionary . How do i choose only this section from the array and create a data dictionary out of it .
For example : ‘MyDataDictionary.sldd’ containing a column named ‘Names’ and the next column named ‘DataTypes’ and all these saved in an sldd format 5all inside amatlab script) .
I want it like an automated script without going into simulink model explorer and then getting the data dictionary.
Any help will be appreciated . matlab, simulink MATLAB Answers — New Questions

​

How to convert digital numerals (1, 2, 3) into number words (‘one’, ‘two’, ‘three’)?
Matlab News

How to convert digital numerals (1, 2, 3) into number words (‘one’, ‘two’, ‘three’)?

PuTI / 2025-01-31

I have input data like:
1
2
3
4
13
15
23
and I want the output like:
one
two
three
four
thirteen
fifteen
twenty threeI have input data like:
1
2
3
4
13
15
23
and I want the output like:
one
two
three
four
thirteen
fifteen
twenty three I have input data like:
1
2
3
4
13
15
23
and I want the output like:
one
two
three
four
thirteen
fifteen
twenty three convert, text MATLAB Answers — New Questions

​

error in using fscanf
Matlab News

error in using fscanf

PuTI / 2025-01-31

I have a script like this:
%Inputing POE
file_01=’POE_0.01.txt’;
fid=fopen(file_01, ‘r’);
FileName_01=fscanf(fid,’%g %g %g’, [3,Inf])’;

Mag_01=FileName_01(:,1); % moment magnitude
Dist_01=FileName_01(:,2); % distance
POE_01=FileName_01(:,3); % probability of exceedance

I = (mod(1:length(Mag_01),30)==1);
Mag = Mag_01(I);
Dist = Dist_01(1:30);

POE_01 = reshape(POE_01,30,15);
marginal(1:15,1) = sum(POE_01);

file_POE = [‘POE_0.5.txt’,’POE_0.2.txt’,’POE_0.1.txt’,’POE_0.05.txt’, …
‘POE_0.02.txt’,’POE_0.01.txt’,’POE_0.005.txt’];

for i = 1:7
file_temp=file_POE(i);
fid=fopen(file_temp, ‘r’);
FileName_temp=fscanf(fid,’%2.2f %g %g’, [3,Inf])’;

POE=FileName_temp(:,3); % probability of exceedance

marginal(1:15,i)=sum(reshape(POE,30,15));
temp=sum(marginal);
hold on

plot(Mag,marginal(1:15,i)/temp(i),’DisplayName’,file_POE(i))
xlabel(‘Magnitude (Mw)’);
ylabel(‘Contribution to the Hazard’);

end
xlim([4.5 8.8])
legend

I got a massage about :
Error using fscanf
Invalid file identifier. Use fopen to generate a valid file identifier.

Error in inputing_data (line 73)
FileName_temp=fscanf(fid,’%g %g %g’, [3,Inf

Is there any one can help?I have a script like this:
%Inputing POE
file_01=’POE_0.01.txt’;
fid=fopen(file_01, ‘r’);
FileName_01=fscanf(fid,’%g %g %g’, [3,Inf])’;

Mag_01=FileName_01(:,1); % moment magnitude
Dist_01=FileName_01(:,2); % distance
POE_01=FileName_01(:,3); % probability of exceedance

I = (mod(1:length(Mag_01),30)==1);
Mag = Mag_01(I);
Dist = Dist_01(1:30);

POE_01 = reshape(POE_01,30,15);
marginal(1:15,1) = sum(POE_01);

file_POE = [‘POE_0.5.txt’,’POE_0.2.txt’,’POE_0.1.txt’,’POE_0.05.txt’, …
‘POE_0.02.txt’,’POE_0.01.txt’,’POE_0.005.txt’];

for i = 1:7
file_temp=file_POE(i);
fid=fopen(file_temp, ‘r’);
FileName_temp=fscanf(fid,’%2.2f %g %g’, [3,Inf])’;

POE=FileName_temp(:,3); % probability of exceedance

marginal(1:15,i)=sum(reshape(POE,30,15));
temp=sum(marginal);
hold on

plot(Mag,marginal(1:15,i)/temp(i),’DisplayName’,file_POE(i))
xlabel(‘Magnitude (Mw)’);
ylabel(‘Contribution to the Hazard’);

end
xlim([4.5 8.8])
legend

I got a massage about :
Error using fscanf
Invalid file identifier. Use fopen to generate a valid file identifier.

Error in inputing_data (line 73)
FileName_temp=fscanf(fid,’%g %g %g’, [3,Inf

Is there any one can help? I have a script like this:
%Inputing POE
file_01=’POE_0.01.txt’;
fid=fopen(file_01, ‘r’);
FileName_01=fscanf(fid,’%g %g %g’, [3,Inf])’;

Mag_01=FileName_01(:,1); % moment magnitude
Dist_01=FileName_01(:,2); % distance
POE_01=FileName_01(:,3); % probability of exceedance

I = (mod(1:length(Mag_01),30)==1);
Mag = Mag_01(I);
Dist = Dist_01(1:30);

POE_01 = reshape(POE_01,30,15);
marginal(1:15,1) = sum(POE_01);

file_POE = [‘POE_0.5.txt’,’POE_0.2.txt’,’POE_0.1.txt’,’POE_0.05.txt’, …
‘POE_0.02.txt’,’POE_0.01.txt’,’POE_0.005.txt’];

for i = 1:7
file_temp=file_POE(i);
fid=fopen(file_temp, ‘r’);
FileName_temp=fscanf(fid,’%2.2f %g %g’, [3,Inf])’;

POE=FileName_temp(:,3); % probability of exceedance

marginal(1:15,i)=sum(reshape(POE,30,15));
temp=sum(marginal);
hold on

plot(Mag,marginal(1:15,i)/temp(i),’DisplayName’,file_POE(i))
xlabel(‘Magnitude (Mw)’);
ylabel(‘Contribution to the Hazard’);

end
xlim([4.5 8.8])
legend

I got a massage about :
Error using fscanf
Invalid file identifier. Use fopen to generate a valid file identifier.

Error in inputing_data (line 73)
FileName_temp=fscanf(fid,’%g %g %g’, [3,Inf

Is there any one can help? error input and read data MATLAB Answers — New Questions

​

Previous 1 … 33 34 35 36 37 … 101 Next

Search

Categories

  • Matlab
  • Microsoft
  • News
  • Other
Application Package Repository Telkom University

Tags

matlab microsoft opensources
Application Package Download License

Application Package Download License

Adobe
Google for Education
IBM
Matlab
Microsoft
Wordpress
Visual Paradigm
Opensource

Sign Up For Newsletters

Be the First to Know. Sign up for newsletter today

Application Package Repository Telkom University

Portal Application Package Repository Telkom University, for internal use only, empower civitas academica in study and research.

Information

  • Telkom University
  • About Us
  • Contact
  • Forum Discussion
  • FAQ
  • Helpdesk Ticket

Contact Us

  • Ask: Any question please read FAQ
  • Mail: helpdesk@telkomuniversity.ac.id
  • Call: +62 823-1994-9941
  • WA: +62 823-1994-9943
  • Site: Gedung Panambulai. Jl. Telekomunikasi

Copyright © Telkom University. All Rights Reserved. ch

  • FAQ
  • Privacy Policy
  • Term

This Application Package for internal Telkom University only (students and employee). Chiers... Dismiss