Tag Archives: matlab
Alias blanks in the cell array as a string.
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
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’?
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?
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?
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?
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?
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
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
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.
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
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
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?
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 ?
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’)?
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
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
How do I convert a .m with unsupported in-built MATLAB functions to C++
Hi everyone.
I’m currently trying to convert a MATLAB script to C++ but MATLAB Coder gives some errors saying some functions are unsupported in the code conversion.
Below are the unsupported functions
fullfile is not supported for code generation
com.mathworks.toolbox.coder.screener.ScreenerError@ca978627
imageSet is not supported for code generation
com.mathworks.toolbox.coder.screener.ScreenerError@36c733bd
partition is not supported for code generation
com.mathworks.toolbox.coder.screener.ScreenerError@b1e1e753
bagOfFeatures is not supported for code generation
com.mathworks.toolbox.coder.screener.ScreenerError@3e7efb02
encode is not supported for code generation
com.mathworks.toolbox.coder.screener.ScreenerError@31cdf3a9
bar is not supported for code generation
com.mathworks.toolbox.coder.screener.ScreenerError@83fd9938Hi everyone.
I’m currently trying to convert a MATLAB script to C++ but MATLAB Coder gives some errors saying some functions are unsupported in the code conversion.
Below are the unsupported functions
fullfile is not supported for code generation
com.mathworks.toolbox.coder.screener.ScreenerError@ca978627
imageSet is not supported for code generation
com.mathworks.toolbox.coder.screener.ScreenerError@36c733bd
partition is not supported for code generation
com.mathworks.toolbox.coder.screener.ScreenerError@b1e1e753
bagOfFeatures is not supported for code generation
com.mathworks.toolbox.coder.screener.ScreenerError@3e7efb02
encode is not supported for code generation
com.mathworks.toolbox.coder.screener.ScreenerError@31cdf3a9
bar is not supported for code generation
com.mathworks.toolbox.coder.screener.ScreenerError@83fd9938 Hi everyone.
I’m currently trying to convert a MATLAB script to C++ but MATLAB Coder gives some errors saying some functions are unsupported in the code conversion.
Below are the unsupported functions
fullfile is not supported for code generation
com.mathworks.toolbox.coder.screener.ScreenerError@ca978627
imageSet is not supported for code generation
com.mathworks.toolbox.coder.screener.ScreenerError@36c733bd
partition is not supported for code generation
com.mathworks.toolbox.coder.screener.ScreenerError@b1e1e753
bagOfFeatures is not supported for code generation
com.mathworks.toolbox.coder.screener.ScreenerError@3e7efb02
encode is not supported for code generation
com.mathworks.toolbox.coder.screener.ScreenerError@31cdf3a9
bar is not supported for code generation
com.mathworks.toolbox.coder.screener.ScreenerError@83fd9938 matlab coder, coder, fullfile MATLAB Answers — New Questions
Looking for help in using structs in multiple functions
I am trying to use structs, but I have no idea what a 0x1 struct is, and I am trying to add to the struct outside of a function, but I don’t understand how they work. None of the websites have a good explanation of how to use the struct. Plus, I get an error when I use the dot method to add to it.I am trying to use structs, but I have no idea what a 0x1 struct is, and I am trying to add to the struct outside of a function, but I don’t understand how they work. None of the websites have a good explanation of how to use the struct. Plus, I get an error when I use the dot method to add to it. I am trying to use structs, but I have no idea what a 0x1 struct is, and I am trying to add to the struct outside of a function, but I don’t understand how they work. None of the websites have a good explanation of how to use the struct. Plus, I get an error when I use the dot method to add to it. structs MATLAB Answers — New Questions
Modeling of cooling plate
Hello Team,
I am using simscape foundation library to model side cooling of a cylidrical cell which is represented by a thermal mass and the heat generation in each cell is represented by heat source.
There are two plates on each cell, the top plate and the bottom plate. the bottom plate is where the fluid is entering at certain flow rate, temperature and pressure. and after passing through all the bottom plates for a series of cells, the fluid enters the top plate and then exits the system.
I am currently modeling it in simscape using foundation library and not able to simulate the model, as I am not able to provide flow rate, temperatrure and pressure properly and cannot implement closed loop system.
Please help me in modeling thisHello Team,
I am using simscape foundation library to model side cooling of a cylidrical cell which is represented by a thermal mass and the heat generation in each cell is represented by heat source.
There are two plates on each cell, the top plate and the bottom plate. the bottom plate is where the fluid is entering at certain flow rate, temperature and pressure. and after passing through all the bottom plates for a series of cells, the fluid enters the top plate and then exits the system.
I am currently modeling it in simscape using foundation library and not able to simulate the model, as I am not able to provide flow rate, temperatrure and pressure properly and cannot implement closed loop system.
Please help me in modeling this Hello Team,
I am using simscape foundation library to model side cooling of a cylidrical cell which is represented by a thermal mass and the heat generation in each cell is represented by heat source.
There are two plates on each cell, the top plate and the bottom plate. the bottom plate is where the fluid is entering at certain flow rate, temperature and pressure. and after passing through all the bottom plates for a series of cells, the fluid enters the top plate and then exits the system.
I am currently modeling it in simscape using foundation library and not able to simulate the model, as I am not able to provide flow rate, temperatrure and pressure properly and cannot implement closed loop system.
Please help me in modeling this cooling plate, battery_system_management, thermal, pipe, pressure, temperature, flow rate, thermal fluid MATLAB Answers — New Questions
i have a problem on Enumerations data type
how to create a script that changes the name of enumeration variables in an sldd filehow to create a script that changes the name of enumeration variables in an sldd file how to create a script that changes the name of enumeration variables in an sldd file sldd datadictionary MATLAB Answers — New Questions