Category: Matlab
Category Archives: Matlab
how to write objective function
i want to pso algorithm on svr model ,as far as i know i need to write objective function in first code and determine other parameter to rest.
i got the objective function svr but i don’t know how to write that i used it in my pso algorithm then i found optimaziton of costfunction and penalty factor and insensitive lossi want to pso algorithm on svr model ,as far as i know i need to write objective function in first code and determine other parameter to rest.
i got the objective function svr but i don’t know how to write that i used it in my pso algorithm then i found optimaziton of costfunction and penalty factor and insensitive loss i want to pso algorithm on svr model ,as far as i know i need to write objective function in first code and determine other parameter to rest.
i got the objective function svr but i don’t know how to write that i used it in my pso algorithm then i found optimaziton of costfunction and penalty factor and insensitive loss svr, pso MATLAB Answers — New Questions
Optimization with 3 variables- how to find the values of each variable to minimize mass?
I have an infrastructure where a metal sheet must be produced. An excavator, an electrolysis reactor, and a 3D printer must be used.
All this has to be performed in 3650 days. So, I am trying to kind of optimize it and find how many excavators, reactors, and 3D printers will give the smallest mass but will also be able to get the job done in 3650 days. I am not sure if and how a code can be written for that. Any help would be appreciated.
days_req=3650; %
m_sheet=linspace(100,10000,200); % mass of a metal sheet
% excavator
n_excav=1:1:200; % number of excavators
m_excav=67; % mass of each excavator
m_tot_excav=n_RASSORs*m_RASSOR; % mass for n excavators
excav_cap=n_excav*6536; % kg/day
days_excav=ceil(m_sheet./excav_cap./n_excav); % days to excavate
% electrolysis reactor
n_react=1:1:200; % number of reactors
m_react=2000; % mass of each reactor
m_tot_react=n_react*m_react; % mass for n reactors
prod_rate_react=7*24; % kg/day of regolith
days_react=ceil(m_sheet./prod_rate_react./n_react); % days to process m_sheet
% printer
n_printer=1:1:200; % number of printers
m_printer=3500; % mass of each printer
m_tot_printer=n_printer*m_printer; % mass for n printers
deposition_rate=n_printer*14.4; % kg/day
days_print=ceil(m_sheet./deposition_rate./n_printer); % days to printI have an infrastructure where a metal sheet must be produced. An excavator, an electrolysis reactor, and a 3D printer must be used.
All this has to be performed in 3650 days. So, I am trying to kind of optimize it and find how many excavators, reactors, and 3D printers will give the smallest mass but will also be able to get the job done in 3650 days. I am not sure if and how a code can be written for that. Any help would be appreciated.
days_req=3650; %
m_sheet=linspace(100,10000,200); % mass of a metal sheet
% excavator
n_excav=1:1:200; % number of excavators
m_excav=67; % mass of each excavator
m_tot_excav=n_RASSORs*m_RASSOR; % mass for n excavators
excav_cap=n_excav*6536; % kg/day
days_excav=ceil(m_sheet./excav_cap./n_excav); % days to excavate
% electrolysis reactor
n_react=1:1:200; % number of reactors
m_react=2000; % mass of each reactor
m_tot_react=n_react*m_react; % mass for n reactors
prod_rate_react=7*24; % kg/day of regolith
days_react=ceil(m_sheet./prod_rate_react./n_react); % days to process m_sheet
% printer
n_printer=1:1:200; % number of printers
m_printer=3500; % mass of each printer
m_tot_printer=n_printer*m_printer; % mass for n printers
deposition_rate=n_printer*14.4; % kg/day
days_print=ceil(m_sheet./deposition_rate./n_printer); % days to print I have an infrastructure where a metal sheet must be produced. An excavator, an electrolysis reactor, and a 3D printer must be used.
All this has to be performed in 3650 days. So, I am trying to kind of optimize it and find how many excavators, reactors, and 3D printers will give the smallest mass but will also be able to get the job done in 3650 days. I am not sure if and how a code can be written for that. Any help would be appreciated.
days_req=3650; %
m_sheet=linspace(100,10000,200); % mass of a metal sheet
% excavator
n_excav=1:1:200; % number of excavators
m_excav=67; % mass of each excavator
m_tot_excav=n_RASSORs*m_RASSOR; % mass for n excavators
excav_cap=n_excav*6536; % kg/day
days_excav=ceil(m_sheet./excav_cap./n_excav); % days to excavate
% electrolysis reactor
n_react=1:1:200; % number of reactors
m_react=2000; % mass of each reactor
m_tot_react=n_react*m_react; % mass for n reactors
prod_rate_react=7*24; % kg/day of regolith
days_react=ceil(m_sheet./prod_rate_react./n_react); % days to process m_sheet
% printer
n_printer=1:1:200; % number of printers
m_printer=3500; % mass of each printer
m_tot_printer=n_printer*m_printer; % mass for n printers
deposition_rate=n_printer*14.4; % kg/day
days_print=ceil(m_sheet./deposition_rate./n_printer); % days to print optimization MATLAB Answers — New Questions
For Loop to Cycle through Struct
I have a 6×1 struct and want to create a for loop that will cycle through and pull out the name field of the 1×1 struct.
How can I do that? ** I am using R2012a **
I apologize for the strange format, the toolbar at the top of the body is missing and I’m still trying to fix it.I have a 6×1 struct and want to create a for loop that will cycle through and pull out the name field of the 1×1 struct.
How can I do that? ** I am using R2012a **
I apologize for the strange format, the toolbar at the top of the body is missing and I’m still trying to fix it. I have a 6×1 struct and want to create a for loop that will cycle through and pull out the name field of the 1×1 struct.
How can I do that? ** I am using R2012a **
I apologize for the strange format, the toolbar at the top of the body is missing and I’m still trying to fix it. struct, fieldname MATLAB Answers — New Questions
Error while loading the old session in PIVlab (the GUI says loading session but it never loads)
Post Content Post Content pivlab, piv MATLAB Answers — New Questions
A problem about implementing soft-decision decode in an OFDM system
Hello,everyone. Recently I am working on a project of simulating a whole OFDM system.
I have made some progress. Now I want to change me (2,1,7) convolutional code – hard decode to soft-decision decode in order to get a better performance. I have learned from the matlab example how to implement soft-decision decode in an AWGN channel. But now I also want to apply it to a fast and multi-path fading channel. As a result of that, I am not sure about the value of noise power when calculate LLR.
I first pass my signal to a fading channel by using comm.RayleighChannel() , then I add noise by using awgn() block. This will give a noise power value.
[y_re,noise_var]=awgn(x_tr,SNR_dB(i),’measured’);
Then I do LS channel estimation and equalization at the receiver. This will change the value of the signal, so as the value of the noise. So I also calculate the noise power at this time.
noise_var_1= 10^(-SNR_dB(i)/10)* mean(Y_equalized.*conj(Y_equalized));
The two power values will be totally different since one is computed with the channel effect and one is not (with channel equalization). So wich value should I use to calculate LLR?
Thanks for your reading and hope you have some ideas about this question.Hello,everyone. Recently I am working on a project of simulating a whole OFDM system.
I have made some progress. Now I want to change me (2,1,7) convolutional code – hard decode to soft-decision decode in order to get a better performance. I have learned from the matlab example how to implement soft-decision decode in an AWGN channel. But now I also want to apply it to a fast and multi-path fading channel. As a result of that, I am not sure about the value of noise power when calculate LLR.
I first pass my signal to a fading channel by using comm.RayleighChannel() , then I add noise by using awgn() block. This will give a noise power value.
[y_re,noise_var]=awgn(x_tr,SNR_dB(i),’measured’);
Then I do LS channel estimation and equalization at the receiver. This will change the value of the signal, so as the value of the noise. So I also calculate the noise power at this time.
noise_var_1= 10^(-SNR_dB(i)/10)* mean(Y_equalized.*conj(Y_equalized));
The two power values will be totally different since one is computed with the channel effect and one is not (with channel equalization). So wich value should I use to calculate LLR?
Thanks for your reading and hope you have some ideas about this question. Hello,everyone. Recently I am working on a project of simulating a whole OFDM system.
I have made some progress. Now I want to change me (2,1,7) convolutional code – hard decode to soft-decision decode in order to get a better performance. I have learned from the matlab example how to implement soft-decision decode in an AWGN channel. But now I also want to apply it to a fast and multi-path fading channel. As a result of that, I am not sure about the value of noise power when calculate LLR.
I first pass my signal to a fading channel by using comm.RayleighChannel() , then I add noise by using awgn() block. This will give a noise power value.
[y_re,noise_var]=awgn(x_tr,SNR_dB(i),’measured’);
Then I do LS channel estimation and equalization at the receiver. This will change the value of the signal, so as the value of the noise. So I also calculate the noise power at this time.
noise_var_1= 10^(-SNR_dB(i)/10)* mean(Y_equalized.*conj(Y_equalized));
The two power values will be totally different since one is computed with the channel effect and one is not (with channel equalization). So wich value should I use to calculate LLR?
Thanks for your reading and hope you have some ideas about this question. ofdm, soft-decison decode MATLAB Answers — New Questions
Filtering multiple .csv files based on data from a table
Hello all,
I am trying to filter multiple .csv files (based on data in a separate table. To be more specific I am trying to filter the data from dataTables by "d_Data.Actual.Calculated_Flow" variable, so that it filters the data that are below minFlow or above maxFlow, which are listed in dataList. dataList has several columns the first one lists Tablename that corresponds with names of the tables in dataTables, the 4th & 5th lists corresponding maxFlow & minFlow that I would like to apply for filtering. How can I achieve this?
here is the code:
dataListDir="zoznam_merani.xlsx";
dataDir=’C:UsersU430746OneDrive – DanfossDesktopEHAEHA 1MatlabMatlabSimulation EHA V1Test DataOneDrive_2024-08-16Flow controlEHA_Flow_Control_standard modeEHA_Flow_Control’;
% Loads dataList
dataList=readtable(dataListDir);
% Loads direction to .csv files
dataFiles = dir(fullfile(dataDir, ‘*.csv’));
% Inicialize a cell array for input of tables
dataTables = cell(1, length(dataFiles));
% Loads tables to the dataTables cell array
for i = 1:length(dataFiles)
fileName = fullfile(dataDir, dataFiles(i).name);
dataTables{i} = readtable(fileName,"VariableNamingRule","preserve");
end
% Inicialize a cell array for filtered data
filteredDataTables = cell(1, length(dataFiles));
% Runs through all the tables in dataTables
for i = 1:length(dataTables)
% Finds a row that corresponds with the TableName
rowIndex = strcmp(dataList.TableName, dataFiles(i).name);
if any(rowIndex)
% Gets minFlow & maxFlow for the actual table
minFlow = dataList.minFlow(rowIndex);
maxFlow = dataList.maxFlow(rowIndex);
% Filters the tables based on minFlow & maxFlow
filteredDataTables{i} = dataTables{i}(dataTables{i}.("d_Data.Actual.Calculated_Flow") >= minFlow & dataTables{i}.("d_Data.Actual.Calculated_Flow") <= maxFlow, :);
else
% If the tableName is not available executes no changes
filteredDataTables{i} = dataTables{i};
end
endHello all,
I am trying to filter multiple .csv files (based on data in a separate table. To be more specific I am trying to filter the data from dataTables by "d_Data.Actual.Calculated_Flow" variable, so that it filters the data that are below minFlow or above maxFlow, which are listed in dataList. dataList has several columns the first one lists Tablename that corresponds with names of the tables in dataTables, the 4th & 5th lists corresponding maxFlow & minFlow that I would like to apply for filtering. How can I achieve this?
here is the code:
dataListDir="zoznam_merani.xlsx";
dataDir=’C:UsersU430746OneDrive – DanfossDesktopEHAEHA 1MatlabMatlabSimulation EHA V1Test DataOneDrive_2024-08-16Flow controlEHA_Flow_Control_standard modeEHA_Flow_Control’;
% Loads dataList
dataList=readtable(dataListDir);
% Loads direction to .csv files
dataFiles = dir(fullfile(dataDir, ‘*.csv’));
% Inicialize a cell array for input of tables
dataTables = cell(1, length(dataFiles));
% Loads tables to the dataTables cell array
for i = 1:length(dataFiles)
fileName = fullfile(dataDir, dataFiles(i).name);
dataTables{i} = readtable(fileName,"VariableNamingRule","preserve");
end
% Inicialize a cell array for filtered data
filteredDataTables = cell(1, length(dataFiles));
% Runs through all the tables in dataTables
for i = 1:length(dataTables)
% Finds a row that corresponds with the TableName
rowIndex = strcmp(dataList.TableName, dataFiles(i).name);
if any(rowIndex)
% Gets minFlow & maxFlow for the actual table
minFlow = dataList.minFlow(rowIndex);
maxFlow = dataList.maxFlow(rowIndex);
% Filters the tables based on minFlow & maxFlow
filteredDataTables{i} = dataTables{i}(dataTables{i}.("d_Data.Actual.Calculated_Flow") >= minFlow & dataTables{i}.("d_Data.Actual.Calculated_Flow") <= maxFlow, :);
else
% If the tableName is not available executes no changes
filteredDataTables{i} = dataTables{i};
end
end Hello all,
I am trying to filter multiple .csv files (based on data in a separate table. To be more specific I am trying to filter the data from dataTables by "d_Data.Actual.Calculated_Flow" variable, so that it filters the data that are below minFlow or above maxFlow, which are listed in dataList. dataList has several columns the first one lists Tablename that corresponds with names of the tables in dataTables, the 4th & 5th lists corresponding maxFlow & minFlow that I would like to apply for filtering. How can I achieve this?
here is the code:
dataListDir="zoznam_merani.xlsx";
dataDir=’C:UsersU430746OneDrive – DanfossDesktopEHAEHA 1MatlabMatlabSimulation EHA V1Test DataOneDrive_2024-08-16Flow controlEHA_Flow_Control_standard modeEHA_Flow_Control’;
% Loads dataList
dataList=readtable(dataListDir);
% Loads direction to .csv files
dataFiles = dir(fullfile(dataDir, ‘*.csv’));
% Inicialize a cell array for input of tables
dataTables = cell(1, length(dataFiles));
% Loads tables to the dataTables cell array
for i = 1:length(dataFiles)
fileName = fullfile(dataDir, dataFiles(i).name);
dataTables{i} = readtable(fileName,"VariableNamingRule","preserve");
end
% Inicialize a cell array for filtered data
filteredDataTables = cell(1, length(dataFiles));
% Runs through all the tables in dataTables
for i = 1:length(dataTables)
% Finds a row that corresponds with the TableName
rowIndex = strcmp(dataList.TableName, dataFiles(i).name);
if any(rowIndex)
% Gets minFlow & maxFlow for the actual table
minFlow = dataList.minFlow(rowIndex);
maxFlow = dataList.maxFlow(rowIndex);
% Filters the tables based on minFlow & maxFlow
filteredDataTables{i} = dataTables{i}(dataTables{i}.("d_Data.Actual.Calculated_Flow") >= minFlow & dataTables{i}.("d_Data.Actual.Calculated_Flow") <= maxFlow, :);
else
% If the tableName is not available executes no changes
filteredDataTables{i} = dataTables{i};
end
end filter, csv, cell array, multiple tables, multiple MATLAB Answers — New Questions
Why is the preprocessor check #if ( UCHAR_MAX != (0xFFU) ) || ( SCHAR_MAX != (0x7F) ) being generated in private.h?
In the generated code for my model, I have noticed that the following code is generated in the "model_private.h" file:
#if ( UCHAR_MAX != (0xFFU) ) || ( SCHAR_MAX != (0x7F) )
#error Code was generated for compiler with different sized uchar/char.
Consider adjusting Test hardware word size settings on the
Hardware Implementation pane to match your compiler word sizes as
defined in limits.h of the compiler. Alternatively, you can
select the Test hardware is the same as production hardware option and
select the Enable portable word sizes option on the Code Generation >
Verification pane for ERT based targets, which will disable the
preprocessor word size checks.
#endif
Why is this code being generated?In the generated code for my model, I have noticed that the following code is generated in the "model_private.h" file:
#if ( UCHAR_MAX != (0xFFU) ) || ( SCHAR_MAX != (0x7F) )
#error Code was generated for compiler with different sized uchar/char.
Consider adjusting Test hardware word size settings on the
Hardware Implementation pane to match your compiler word sizes as
defined in limits.h of the compiler. Alternatively, you can
select the Test hardware is the same as production hardware option and
select the Enable portable word sizes option on the Code Generation >
Verification pane for ERT based targets, which will disable the
preprocessor word size checks.
#endif
Why is this code being generated? In the generated code for my model, I have noticed that the following code is generated in the "model_private.h" file:
#if ( UCHAR_MAX != (0xFFU) ) || ( SCHAR_MAX != (0x7F) )
#error Code was generated for compiler with different sized uchar/char.
Consider adjusting Test hardware word size settings on the
Hardware Implementation pane to match your compiler word sizes as
defined in limits.h of the compiler. Alternatively, you can
select the Test hardware is the same as production hardware option and
select the Enable portable word sizes option on the Code Generation >
Verification pane for ERT based targets, which will disable the
preprocessor word size checks.
#endif
Why is this code being generated? fixedpoint, codegen, header, check, limit MATLAB Answers — New Questions
how to create a histogram for featim?
hi matlab community, is something wrong with my coding below? i want to create a histogram for featim. thnkyou so much.
feat=zeros(982,40);
for k=1:982
A=FYPdatabase{k,1};
featim=gmlog(A);
FYPdatabase{k,5}=featim;
end
hist3(featim);hi matlab community, is something wrong with my coding below? i want to create a histogram for featim. thnkyou so much.
feat=zeros(982,40);
for k=1:982
A=FYPdatabase{k,1};
featim=gmlog(A);
FYPdatabase{k,5}=featim;
end
hist3(featim); hi matlab community, is something wrong with my coding below? i want to create a histogram for featim. thnkyou so much.
feat=zeros(982,40);
for k=1:982
A=FYPdatabase{k,1};
featim=gmlog(A);
FYPdatabase{k,5}=featim;
end
hist3(featim); image processing MATLAB Answers — New Questions
Halo i want to combine 2d slices oct skin images into 3d, after that i want to make an automatic detection volume of epidermis and stratum corneum
i already combine like this
% Initialize variables
rows = []; columns = [];
% Loop through each slice
for k = 1:100
fileName = sprintf(‘_%d.txt’, k);
% Read the text file
sliceImage = dlmread(fileName);
% Check the size of the first slice to initialize the 3D array
if isempty(rows) || isempty(columns)
[rows, columns] = size(sliceImage);
image3d = zeros(rows, columns, 8, ‘uint8’); % Initialize 3D array
end
% Convert to uint8
sliceImage = uint8(sliceImage);
% Put this slice into plane k of the 3D image
image3d(:, :, k) = sliceImage;
endi already combine like this
% Initialize variables
rows = []; columns = [];
% Loop through each slice
for k = 1:100
fileName = sprintf(‘_%d.txt’, k);
% Read the text file
sliceImage = dlmread(fileName);
% Check the size of the first slice to initialize the 3D array
if isempty(rows) || isempty(columns)
[rows, columns] = size(sliceImage);
image3d = zeros(rows, columns, 8, ‘uint8’); % Initialize 3D array
end
% Convert to uint8
sliceImage = uint8(sliceImage);
% Put this slice into plane k of the 3D image
image3d(:, :, k) = sliceImage;
end i already combine like this
% Initialize variables
rows = []; columns = [];
% Loop through each slice
for k = 1:100
fileName = sprintf(‘_%d.txt’, k);
% Read the text file
sliceImage = dlmread(fileName);
% Check the size of the first slice to initialize the 3D array
if isempty(rows) || isempty(columns)
[rows, columns] = size(sliceImage);
image3d = zeros(rows, columns, 8, ‘uint8’); % Initialize 3D array
end
% Convert to uint8
sliceImage = uint8(sliceImage);
% Put this slice into plane k of the 3D image
image3d(:, :, k) = sliceImage;
end 3d plots, image segmentation MATLAB Answers — New Questions
how to export model coordinates?
Hello,
I am running the example spiralInductor.
Is there a way to export the geometry for fabrication?
Thank youHello,
I am running the example spiralInductor.
Is there a way to export the geometry for fabrication?
Thank you Hello,
I am running the example spiralInductor.
Is there a way to export the geometry for fabrication?
Thank you coil, matlab coder, microwave, performance MATLAB Answers — New Questions
Remogenerate optimized code by removing code for out-of-range floating point to integer conversions did not improve execution speed,is there a problem?
I want to improve the running speed of the code converted from Simulink to C coder, so I tried setting the maximum running speed mode in it, but the result was similar to balancing RAM and speed mode. So I tried to modify more detailed settings, I tried to modify the settings to regenerate optimized code by removing out of range floating-point to integer conversion code, but still had no effect. Why is this? Is there any other setting in the model that can improve the running speed of the code? Or should I directly modify the structure of the code to improve speed?I want to improve the running speed of the code converted from Simulink to C coder, so I tried setting the maximum running speed mode in it, but the result was similar to balancing RAM and speed mode. So I tried to modify more detailed settings, I tried to modify the settings to regenerate optimized code by removing out of range floating-point to integer conversion code, but still had no effect. Why is this? Is there any other setting in the model that can improve the running speed of the code? Or should I directly modify the structure of the code to improve speed? I want to improve the running speed of the code converted from Simulink to C coder, so I tried setting the maximum running speed mode in it, but the result was similar to balancing RAM and speed mode. So I tried to modify more detailed settings, I tried to modify the settings to regenerate optimized code by removing out of range floating-point to integer conversion code, but still had no effect. Why is this? Is there any other setting in the model that can improve the running speed of the code? Or should I directly modify the structure of the code to improve speed? simulink, embedded coder MATLAB Answers — New Questions
How to average across tables in a cell
I have a Cell containing a n number of tables (in this case 3 tables (2500×44)) and I’m trying output just one table being the average of each cell within each table across all 3 tables. This is likely a silly question but can’t seem to figure it out.I have a Cell containing a n number of tables (in this case 3 tables (2500×44)) and I’m trying output just one table being the average of each cell within each table across all 3 tables. This is likely a silly question but can’t seem to figure it out. I have a Cell containing a n number of tables (in this case 3 tables (2500×44)) and I’m trying output just one table being the average of each cell within each table across all 3 tables. This is likely a silly question but can’t seem to figure it out. cell array, table, mean MATLAB Answers — New Questions
Why there is a time delay of one time step while co-simulating a FMU in Simulink?
I exported an FMU from a Simulink model with Simulink Compiler and imported it into Simulink with FMU Import block.
In the results, when comparing the Simulink output and the FMU output, I see that they do not match with a one-time step difference/one-time step delay.
What is causing this behavior?I exported an FMU from a Simulink model with Simulink Compiler and imported it into Simulink with FMU Import block.
In the results, when comparing the Simulink output and the FMU output, I see that they do not match with a one-time step difference/one-time step delay.
What is causing this behavior? I exported an FMU from a Simulink model with Simulink Compiler and imported it into Simulink with FMU Import block.
In the results, when comparing the Simulink output and the FMU output, I see that they do not match with a one-time step difference/one-time step delay.
What is causing this behavior? fmu, delay, time, step, different, results, simulink, fmi MATLAB Answers — New Questions
Interpolating between columns for an index
I am trying to use a seperate array as an index and a variable.
E.g.
Row 1 I want to use as index, or lookup.
Row 2 are data
550 750 950
1 2 8
Column 1 would be reference from row 1
Column 2 would be multiplied against row 2 depending on how Column 1 relates to row 1
550 22
580 21
650 20
623 28
850 14
So my goal is using the second set of data.
at 550, 22 would be multiplied by 1,
at 650, 20 would be multiplied by 1.5
at 850, 14 would be multiplied by 5
I tried search for awhile on the community and through the "basics"
I might be wording this wrong by calling it indexing.I am trying to use a seperate array as an index and a variable.
E.g.
Row 1 I want to use as index, or lookup.
Row 2 are data
550 750 950
1 2 8
Column 1 would be reference from row 1
Column 2 would be multiplied against row 2 depending on how Column 1 relates to row 1
550 22
580 21
650 20
623 28
850 14
So my goal is using the second set of data.
at 550, 22 would be multiplied by 1,
at 650, 20 would be multiplied by 1.5
at 850, 14 would be multiplied by 5
I tried search for awhile on the community and through the "basics"
I might be wording this wrong by calling it indexing. I am trying to use a seperate array as an index and a variable.
E.g.
Row 1 I want to use as index, or lookup.
Row 2 are data
550 750 950
1 2 8
Column 1 would be reference from row 1
Column 2 would be multiplied against row 2 depending on how Column 1 relates to row 1
550 22
580 21
650 20
623 28
850 14
So my goal is using the second set of data.
at 550, 22 would be multiplied by 1,
at 650, 20 would be multiplied by 1.5
at 850, 14 would be multiplied by 5
I tried search for awhile on the community and through the "basics"
I might be wording this wrong by calling it indexing. basics, interpolation, indexing MATLAB Answers — New Questions
Trying to sign out of MATLAB desktop
I am trying to sign out of my MATLAB account on the desktop app, yet it is not letting me.
I keep getting this message, although I have nothing open aside from MATLAB and no scripts are running: Before signing out you must:
Close all MATLAB sessions, including the current one.Note: Restarting MATLAB requires internet access.I am trying to sign out of my MATLAB account on the desktop app, yet it is not letting me.
I keep getting this message, although I have nothing open aside from MATLAB and no scripts are running: Before signing out you must:
Close all MATLAB sessions, including the current one.Note: Restarting MATLAB requires internet access. I am trying to sign out of my MATLAB account on the desktop app, yet it is not letting me.
I keep getting this message, although I have nothing open aside from MATLAB and no scripts are running: Before signing out you must:
Close all MATLAB sessions, including the current one.Note: Restarting MATLAB requires internet access. matlab MATLAB Answers — New Questions
Detecting circles in an image to measure inner and outer diameter
Any reason why this code won’t detect the inner and outer diamter of the tube seen in the image below?
a = imread(‘E1-E2.jpg’);
imshow(a);
% Center and radius
[centers,radii] = imfindcircles(a,[20 1000],’ObjectPolarity’,’bright’, ‘Sensitivity’,0.95);
diameter = radii*2;
viscircles(centers, radii,’Color’,’b’);Any reason why this code won’t detect the inner and outer diamter of the tube seen in the image below?
a = imread(‘E1-E2.jpg’);
imshow(a);
% Center and radius
[centers,radii] = imfindcircles(a,[20 1000],’ObjectPolarity’,’bright’, ‘Sensitivity’,0.95);
diameter = radii*2;
viscircles(centers, radii,’Color’,’b’); Any reason why this code won’t detect the inner and outer diamter of the tube seen in the image below?
a = imread(‘E1-E2.jpg’);
imshow(a);
% Center and radius
[centers,radii] = imfindcircles(a,[20 1000],’ObjectPolarity’,’bright’, ‘Sensitivity’,0.95);
diameter = radii*2;
viscircles(centers, radii,’Color’,’b’); image, circle, wrong lens, image analysis MATLAB Answers — New Questions
Reading data from Microsoft Excel
What is the syntax for reading data from Microsoft Excel sheets? I tried the following and it returned error messages.
A = xlsread(‘amat.xlsx’,’sheet1′,’a1:a10′)
I even changed the case of S in sheet to capital and the error persisted. Anyone with an idea?What is the syntax for reading data from Microsoft Excel sheets? I tried the following and it returned error messages.
A = xlsread(‘amat.xlsx’,’sheet1′,’a1:a10′)
I even changed the case of S in sheet to capital and the error persisted. Anyone with an idea? What is the syntax for reading data from Microsoft Excel sheets? I tried the following and it returned error messages.
A = xlsread(‘amat.xlsx’,’sheet1′,’a1:a10′)
I even changed the case of S in sheet to capital and the error persisted. Anyone with an idea? transferred MATLAB Answers — New Questions
How to deal with corrupted matlabprefs?
I run a matlab-script that use batch processing to collect sample from different sensors at same time.
Some sensors are connect using UDP protocol, modbus, and serial port.
As a rule, they work fine. However, sometimes I have an error related to matlabprefs.mat.
As a consequence, one of the sensors can stop to collect data, i.e., I can not read correctly form a specific serial port, and in the next time I run the same matlab script, it will fail producing some complaining about "matlabprefs.mat" (see example below).
I have this problem frequently.
I am affraid becasue If I can not deal properlly with this problem,I can not trust on matlab to control my data sample system.
Please, could you help me to figure out a deffinitive solution for this issue?
Warning: Initializing MATLAB Graphics failed.
This indicates a potentially serious problem in your MATLAB setup, which should be resolved as soon as possible. Error detected was:
MATLAB:load:unableToReadMatFile
Unable to read MAT-file C:UsersuserAppDataRoamingMathWorksMATLABR2023amatlabprefs.mat. File might be corrupt.
> In hgrc (line 151)
In matlab.graphics.internal.initialize (line 15)I run a matlab-script that use batch processing to collect sample from different sensors at same time.
Some sensors are connect using UDP protocol, modbus, and serial port.
As a rule, they work fine. However, sometimes I have an error related to matlabprefs.mat.
As a consequence, one of the sensors can stop to collect data, i.e., I can not read correctly form a specific serial port, and in the next time I run the same matlab script, it will fail producing some complaining about "matlabprefs.mat" (see example below).
I have this problem frequently.
I am affraid becasue If I can not deal properlly with this problem,I can not trust on matlab to control my data sample system.
Please, could you help me to figure out a deffinitive solution for this issue?
Warning: Initializing MATLAB Graphics failed.
This indicates a potentially serious problem in your MATLAB setup, which should be resolved as soon as possible. Error detected was:
MATLAB:load:unableToReadMatFile
Unable to read MAT-file C:UsersuserAppDataRoamingMathWorksMATLABR2023amatlabprefs.mat. File might be corrupt.
> In hgrc (line 151)
In matlab.graphics.internal.initialize (line 15) I run a matlab-script that use batch processing to collect sample from different sensors at same time.
Some sensors are connect using UDP protocol, modbus, and serial port.
As a rule, they work fine. However, sometimes I have an error related to matlabprefs.mat.
As a consequence, one of the sensors can stop to collect data, i.e., I can not read correctly form a specific serial port, and in the next time I run the same matlab script, it will fail producing some complaining about "matlabprefs.mat" (see example below).
I have this problem frequently.
I am affraid becasue If I can not deal properlly with this problem,I can not trust on matlab to control my data sample system.
Please, could you help me to figure out a deffinitive solution for this issue?
Warning: Initializing MATLAB Graphics failed.
This indicates a potentially serious problem in your MATLAB setup, which should be resolved as soon as possible. Error detected was:
MATLAB:load:unableToReadMatFile
Unable to read MAT-file C:UsersuserAppDataRoamingMathWorksMATLABR2023amatlabprefs.mat. File might be corrupt.
> In hgrc (line 151)
In matlab.graphics.internal.initialize (line 15) matlabprefs.mat MATLAB Answers — New Questions
function chaining when one function has multiple outputs
Similar question has been asked before, but I would ask the question in a more specific manner. If the function in the input end has more than one output, there will be the error ‘Not enough input arguments’. Is there a neat way to make chained function out of that situation?
f(g) % only the first output of g is kept as input for f
function [x, y] = g()
x = 1;
y = 2;
end
function out = f(x, y)
out = x+y;
end
Storing the outputs of the first function in two variables could be a solution, but I like to see how chaining could be done in this kind of scenario for the sake of learning.
[x, y] = g();
f(x, y)Similar question has been asked before, but I would ask the question in a more specific manner. If the function in the input end has more than one output, there will be the error ‘Not enough input arguments’. Is there a neat way to make chained function out of that situation?
f(g) % only the first output of g is kept as input for f
function [x, y] = g()
x = 1;
y = 2;
end
function out = f(x, y)
out = x+y;
end
Storing the outputs of the first function in two variables could be a solution, but I like to see how chaining could be done in this kind of scenario for the sake of learning.
[x, y] = g();
f(x, y) Similar question has been asked before, but I would ask the question in a more specific manner. If the function in the input end has more than one output, there will be the error ‘Not enough input arguments’. Is there a neat way to make chained function out of that situation?
f(g) % only the first output of g is kept as input for f
function [x, y] = g()
x = 1;
y = 2;
end
function out = f(x, y)
out = x+y;
end
Storing the outputs of the first function in two variables could be a solution, but I like to see how chaining could be done in this kind of scenario for the sake of learning.
[x, y] = g();
f(x, y) chained_function, function_chaining, function_composition MATLAB Answers — New Questions
MATLAB Web Apps are not supported on this device (Phone)
Good night everybody,
I am currently trying to develop a MATLAB Web App on MATLAB Web Server R2020b. This application works fine on Desktop, however if I try to access it on any phone an error "MATLAB Web Apps are not supported on this device" appears. I have accessed the link (https://es.mathworks.com/help/compiler/webapps/supported-browsers-and-platform-incompatibilities.html#:~:text=Web%20apps%20are%20compatible%20with,Chrome%E2%84%A2%20browser%20on%20Chromebooks.) of the error and there is nothing about incompatibility with phones. Are phones and maybe some other devices unhandled by Web Apps or this is some unrelated error which I can’t manage to find? As an example, if I try to access with Chrome or Firefox on a Pixel 2 the error of the image appears, however if I turn on "View in desktop mode" it works correctly and I can see my app.
Thank you all,
MarcosGood night everybody,
I am currently trying to develop a MATLAB Web App on MATLAB Web Server R2020b. This application works fine on Desktop, however if I try to access it on any phone an error "MATLAB Web Apps are not supported on this device" appears. I have accessed the link (https://es.mathworks.com/help/compiler/webapps/supported-browsers-and-platform-incompatibilities.html#:~:text=Web%20apps%20are%20compatible%20with,Chrome%E2%84%A2%20browser%20on%20Chromebooks.) of the error and there is nothing about incompatibility with phones. Are phones and maybe some other devices unhandled by Web Apps or this is some unrelated error which I can’t manage to find? As an example, if I try to access with Chrome or Firefox on a Pixel 2 the error of the image appears, however if I turn on "View in desktop mode" it works correctly and I can see my app.
Thank you all,
Marcos Good night everybody,
I am currently trying to develop a MATLAB Web App on MATLAB Web Server R2020b. This application works fine on Desktop, however if I try to access it on any phone an error "MATLAB Web Apps are not supported on this device" appears. I have accessed the link (https://es.mathworks.com/help/compiler/webapps/supported-browsers-and-platform-incompatibilities.html#:~:text=Web%20apps%20are%20compatible%20with,Chrome%E2%84%A2%20browser%20on%20Chromebooks.) of the error and there is nothing about incompatibility with phones. Are phones and maybe some other devices unhandled by Web Apps or this is some unrelated error which I can’t manage to find? As an example, if I try to access with Chrome or Firefox on a Pixel 2 the error of the image appears, however if I turn on "View in desktop mode" it works correctly and I can see my app.
Thank you all,
Marcos matlab, web app MATLAB Answers — New Questions