Tag Archives: matlab
How can one use a variable to set color of a line plot , and use colorbar?
Dear MAtLab community,
I am creating a simple line plot, and I would like to use a third variable to color the line at every point .
the line comes as:
line(koordmean(:,1),koordmean(:,2))
xlim([1 640])
ylim([1 480])
set(gca,’ydir’,’reverse’)
and the line should be colouread according to the variable ‘anx’. It should work similar to the imagesc function combined with the colorbar function.
Any suggestions are highly appreciated! Kind regards
lgDear MAtLab community,
I am creating a simple line plot, and I would like to use a third variable to color the line at every point .
the line comes as:
line(koordmean(:,1),koordmean(:,2))
xlim([1 640])
ylim([1 480])
set(gca,’ydir’,’reverse’)
and the line should be colouread according to the variable ‘anx’. It should work similar to the imagesc function combined with the colorbar function.
Any suggestions are highly appreciated! Kind regards
lg Dear MAtLab community,
I am creating a simple line plot, and I would like to use a third variable to color the line at every point .
the line comes as:
line(koordmean(:,1),koordmean(:,2))
xlim([1 640])
ylim([1 480])
set(gca,’ydir’,’reverse’)
and the line should be colouread according to the variable ‘anx’. It should work similar to the imagesc function combined with the colorbar function.
Any suggestions are highly appreciated! Kind regards
lg line plot, imagesc, colorbar MATLAB Answers — New Questions
How can I restart the optimization in “Optimize Live Editor”?
I am new in use of MATLAB_. I want to do a nonlinear optimization with genetic algorithm in Solver-based application. My problem is that I failed, but if I start again, it still includes the things and choices I entered before. How can I start with a clean sheet?I am new in use of MATLAB_. I want to do a nonlinear optimization with genetic algorithm in Solver-based application. My problem is that I failed, but if I start again, it still includes the things and choices I entered before. How can I start with a clean sheet? I am new in use of MATLAB_. I want to do a nonlinear optimization with genetic algorithm in Solver-based application. My problem is that I failed, but if I start again, it still includes the things and choices I entered before. How can I start with a clean sheet? use optimize leve editor task MATLAB Answers — New Questions
Error using sdo.SimulationTest/sim
Hello everyone, i’m having an issue with an application, using AppDesigner, but after deployment only.
In the log file, I can find:
Error using sdo.SimulationTest/sim
Unrecognized function or variable ‘private_sl_CPUInfo’.
sim() is called in a sdo.optimize loop in a annonymous function and I don’t understand at all what could cause the issue, and the application is running fine before deployement (in the AppDesigner).
Does anybody already had this issue or knows something about it?Hello everyone, i’m having an issue with an application, using AppDesigner, but after deployment only.
In the log file, I can find:
Error using sdo.SimulationTest/sim
Unrecognized function or variable ‘private_sl_CPUInfo’.
sim() is called in a sdo.optimize loop in a annonymous function and I don’t understand at all what could cause the issue, and the application is running fine before deployement (in the AppDesigner).
Does anybody already had this issue or knows something about it? Hello everyone, i’m having an issue with an application, using AppDesigner, but after deployment only.
In the log file, I can find:
Error using sdo.SimulationTest/sim
Unrecognized function or variable ‘private_sl_CPUInfo’.
sim() is called in a sdo.optimize loop in a annonymous function and I don’t understand at all what could cause the issue, and the application is running fine before deployement (in the AppDesigner).
Does anybody already had this issue or knows something about it? appdesigner, simulink, simscape, simulation MATLAB Answers — New Questions
How to get rid of the error: Error using horzcat. Dimensions of matrices being concatenated are not consistent
Post Content Post Content horzcat MATLAB Answers — New Questions
Mathematics relationship between CDL channels and Saleh-Valenzuela model
Hi everyone,
I’m learning to generate a CDL channel through example CDL Channel Model Customization with Ray Tracing, and I also read some papers about Saleh-Valenzuela model for mmWave, and I see they have some things in common, like AoA, AoD,… But I didn’t find any Matlab source explaining the mathematics behind the functions related to nrCDLChannel() object.
I am wondering if CDL channel use the Saleh-Valenzuela model? Could you please give me some Matlab sites that explain the mathematical formulas behind that? because I saw different papers have different notations of Saleh-Valenzuela model, and it quite confusing for me as a new learner.
Thanks a lot in advance.Hi everyone,
I’m learning to generate a CDL channel through example CDL Channel Model Customization with Ray Tracing, and I also read some papers about Saleh-Valenzuela model for mmWave, and I see they have some things in common, like AoA, AoD,… But I didn’t find any Matlab source explaining the mathematics behind the functions related to nrCDLChannel() object.
I am wondering if CDL channel use the Saleh-Valenzuela model? Could you please give me some Matlab sites that explain the mathematical formulas behind that? because I saw different papers have different notations of Saleh-Valenzuela model, and it quite confusing for me as a new learner.
Thanks a lot in advance. Hi everyone,
I’m learning to generate a CDL channel through example CDL Channel Model Customization with Ray Tracing, and I also read some papers about Saleh-Valenzuela model for mmWave, and I see they have some things in common, like AoA, AoD,… But I didn’t find any Matlab source explaining the mathematics behind the functions related to nrCDLChannel() object.
I am wondering if CDL channel use the Saleh-Valenzuela model? Could you please give me some Matlab sites that explain the mathematical formulas behind that? because I saw different papers have different notations of Saleh-Valenzuela model, and it quite confusing for me as a new learner.
Thanks a lot in advance. cdl channel, saleh-valenzuela, channel model, multi-antenna MATLAB Answers — New Questions
Cant use nested bus objects with bus object arrays in simulink
Hello,
I am trying to build a Bus (struct) (<Quiver>) that has an array of a nested bus type (<Arrow>). Later, I want to dissect this array (<arrows>), loop over it and use the members (<point>, <head>) of that bus object.
However, I get the following error:
Selected signal ‘arrows.origin.x’ in the Bus Selector block ‘Demo/Inport’ is invalid since it refers to a bus element within an array of sub-buses. The path to the array of sub-buses is ‘arrows’. Please select the appropriate array element using a Selector block before using the Bus Selector block to access an element within the bus.
This is very annoying. Programatically this is totally normal, nested stucts. Why can I specify the dimension of that struct array, if it wont compile?
How can I do what I intend to do?
This is what I am doing, basically:Hello,
I am trying to build a Bus (struct) (<Quiver>) that has an array of a nested bus type (<Arrow>). Later, I want to dissect this array (<arrows>), loop over it and use the members (<point>, <head>) of that bus object.
However, I get the following error:
Selected signal ‘arrows.origin.x’ in the Bus Selector block ‘Demo/Inport’ is invalid since it refers to a bus element within an array of sub-buses. The path to the array of sub-buses is ‘arrows’. Please select the appropriate array element using a Selector block before using the Bus Selector block to access an element within the bus.
This is very annoying. Programatically this is totally normal, nested stucts. Why can I specify the dimension of that struct array, if it wont compile?
How can I do what I intend to do?
This is what I am doing, basically: Hello,
I am trying to build a Bus (struct) (<Quiver>) that has an array of a nested bus type (<Arrow>). Later, I want to dissect this array (<arrows>), loop over it and use the members (<point>, <head>) of that bus object.
However, I get the following error:
Selected signal ‘arrows.origin.x’ in the Bus Selector block ‘Demo/Inport’ is invalid since it refers to a bus element within an array of sub-buses. The path to the array of sub-buses is ‘arrows’. Please select the appropriate array element using a Selector block before using the Bus Selector block to access an element within the bus.
This is very annoying. Programatically this is totally normal, nested stucts. Why can I specify the dimension of that struct array, if it wont compile?
How can I do what I intend to do?
This is what I am doing, basically: array, bus, simulink, matlab, error MATLAB Answers — New Questions
How to enable required buttons and plot linear fit from group of graphs
I have created an where i want to enable required buttons based on the input given. I have the maxium limit of the required buttons. My app tells about the mangoes quantity in the basket and the plot are made for the estimation of the ripeness of mangoes. Where i have known about the maximum number of mangoes in basket. What i required is, 1) if i change my input, i don’t want the import excel buttons to be deleted instead those should be diabled. 2) After plotting the graphs, i want to make the linear fit and the squareroot fit to the plotted group of graphs. i have attached my app and the excel file for the plot.I have created an where i want to enable required buttons based on the input given. I have the maxium limit of the required buttons. My app tells about the mangoes quantity in the basket and the plot are made for the estimation of the ripeness of mangoes. Where i have known about the maximum number of mangoes in basket. What i required is, 1) if i change my input, i don’t want the import excel buttons to be deleted instead those should be diabled. 2) After plotting the graphs, i want to make the linear fit and the squareroot fit to the plotted group of graphs. i have attached my app and the excel file for the plot. I have created an where i want to enable required buttons based on the input given. I have the maxium limit of the required buttons. My app tells about the mangoes quantity in the basket and the plot are made for the estimation of the ripeness of mangoes. Where i have known about the maximum number of mangoes in basket. What i required is, 1) if i change my input, i don’t want the import excel buttons to be deleted instead those should be diabled. 2) After plotting the graphs, i want to make the linear fit and the squareroot fit to the plotted group of graphs. i have attached my app and the excel file for the plot. matlab, appdesigner MATLAB Answers — New Questions
Issues setting exact sampling rates when using the data acquisition toolbox in MATLAB’s app designer
Hi all,
I have been having issues setting my sampling rate/ DAQ.Rate to the values 2048 and 120. I am using a start function that is set for x amount of seconds. This then triggers the scansavailablecallback and within this callback it will readout about 1 tenth of the values to be graphed out over time. When setting the DAQ’s Rate to 2048 is collects in sample batches of 205, this leaves the sample batch for 0.9s to 1.0s missing 2 samples and does not end up triggering final 0.1s of the callback. I am not too sure why it does this and am wondering if using the scansavailable callback is part of the issue. I have tried to change the DAQ rate for the 0.9-1.0s time to then activate the callback again but this does not seem to work. A similiar issue happens for 120 where it’s sample batch seems to be 13 which I am quite confused by. Any ideas or guidance on how to go about solving these issues would be greatly appreciated.
This is the callback function
function scansAvailable_Callback(app, src, ~)
% Callback function executed on DAQ object ScansAvailable event
% runs after the start button pushed event is complete
if ~isvalid(app)
return
end
disp (app.numscan)
% Read data from the DAQ object
% Read data from the DAQ object
[app.data, timestamps] = read(src,app.DAQ.ScansAvailableFcnCount, ‘OutputFormat’,’Matrix’);
test = [timestamps,app.data];
assignin("base","test",test)
% Calibration
if app.calibrate == true
% sends data to function to be calibrated appropriately
app.calibratedData = calibrateData(app,app.data, app.sl, app.int);
else
% if calibration is not turned off, just take the voltage values
for jj = app.SelectedChannels
app.calibratedData(:,jj) = (app.data(:,jj));
end
end
% checking too put the app back into configuration @ the end of the
% Store continuous acquisition data in FIFO data buffers
buffersize = round(app.DAQ.Rate * app.TimewindowEditField.Value) + 1;
app.TimestampsFIFOBuffer = storeDataInFIFO(app, app.TimestampsFIFOBuffer, buffersize, timestamps);
app.DataFIFOBufferch1 = storeDataInFIFO(app, app.DataFIFOBufferch1, buffersize, app.calibratedData(:,app.SelectedChannels));
% Plotting (Update the plot every N data points received
updatePlotInterval = 1; % Adjust this value based on your preference
if mod(src.ScansAvailableFcnCount, updatePlotInterval) == 0
% runs function that is responsible for plotting a singular
% graph
updateLivePlot(app);
end
% for data that goes to the workspace and
for ii = 1:(round(app.RateEdit.Value/10))
% keep count of the sample#/time
app.fws_x = app.fws_x + 1;
% initialize data to be written into the workspace
app.fwsdata(app.fws_x,(app.SelectedChannels)) = app.calibratedData(ii,app.SelectedChannels);
end
disp(app.fws_x)
if app.ContinuousSwitch.Value == "Off"
lengthcheck = (app.TrialLengthsEditField.Value* app.RateEdit.Value);
disp(lengthcheck)
if app.fws_x >= lengthcheck
if app.LogRequested
try
% Change the data to a timetable
WSData = array2timetable(app.fwsdata(1:app.TrialLengthsEditField.Value*app.DAQ.Rate,app.SelectedChannels),’SampleRate’,app.RateEdit.Value);
varname = table2array(app.UITable.Data(:,1));
% renames the variable names to match the channel names
for i = app.SelectedChannels
WSData = renamevars(WSData,i,varname(i));
end
% write into base workspace with the name stated in the UI
assignin(‘base’, app.VariableNameEditField.Value, WSData);
assignin("base","variable_name",app.VariableNameEditField.Value)
catch exception
uialert(app.LiveDataAcquisitionUIFigure,exception.message,’You cannot start the variable name with a number’)
end
end
setAppViewState(app, ‘configuration’);
end
end
app.numscan = app.numscan + 1;
end
And the following is what initiates the callback
function StartButtonPushed(app, event)
% so the app can go back into "configuration state"
app.fws_x = 0;
app.fwsdata = 0;
app.wstimestamps= 0;
% clearing the graphs just helps with mainly tab 2 when the
% user is switching where a channels goes (between the 2
% graphs)
cla(app.LiveAxes)
if numel(app.SelectedChannels) == 0
warndlg(‘Please select Channels to record’,’No Channels to Record from Selected’)
else
% dur = isinteger(app.DAQ.Rate/10);
% Disable DAQ device, channel properties, and start acquisition UI components
setAppViewState(app, ‘acquisition’);
% Reset FIFO buffer data
app.calibratedData = [];
app.DataFIFOBufferch1 = [];
app.TimestampsFIFOBuffer = [];
% Checks to see if the app is set to continuous or has a the
% User selected to use a recording window instead
if app.continuous == true
% preallocate for the data that is to be written for
% the workspace
app.fwsdata = zeros(400000,numel(app.numchan));
try
% starts data collection
start(app.DAQ,’continuous’);
catch exception
% In case of error show it and revert the change
uialert(app.LiveDataAcquisitionUIFigure, exception.message, ‘Start error, you may have selected channels too quick!’);
setAppViewState(app, ‘configuration’);
end
else
% preallocate for the data that is to be written for
% the workspace based on the trial length and the
% sample rate
app.fwsdata = zeros((app.RateEdit.Value*app.TrialLengthsEditField.Value),numel(app.numchan));
try
start(app.DAQ,"Duration",app.TrialLengthsEditField.Value)
catch exception
% In case of error show it and revert the change
uialert(app.LiveDataAcquisitionUIFigure, exception.message, ‘Start error’);
setAppViewState(app, ‘configuration’);
end
end
% Clear Log status text
app.LogStatusText.Text = ”;
endHi all,
I have been having issues setting my sampling rate/ DAQ.Rate to the values 2048 and 120. I am using a start function that is set for x amount of seconds. This then triggers the scansavailablecallback and within this callback it will readout about 1 tenth of the values to be graphed out over time. When setting the DAQ’s Rate to 2048 is collects in sample batches of 205, this leaves the sample batch for 0.9s to 1.0s missing 2 samples and does not end up triggering final 0.1s of the callback. I am not too sure why it does this and am wondering if using the scansavailable callback is part of the issue. I have tried to change the DAQ rate for the 0.9-1.0s time to then activate the callback again but this does not seem to work. A similiar issue happens for 120 where it’s sample batch seems to be 13 which I am quite confused by. Any ideas or guidance on how to go about solving these issues would be greatly appreciated.
This is the callback function
function scansAvailable_Callback(app, src, ~)
% Callback function executed on DAQ object ScansAvailable event
% runs after the start button pushed event is complete
if ~isvalid(app)
return
end
disp (app.numscan)
% Read data from the DAQ object
% Read data from the DAQ object
[app.data, timestamps] = read(src,app.DAQ.ScansAvailableFcnCount, ‘OutputFormat’,’Matrix’);
test = [timestamps,app.data];
assignin("base","test",test)
% Calibration
if app.calibrate == true
% sends data to function to be calibrated appropriately
app.calibratedData = calibrateData(app,app.data, app.sl, app.int);
else
% if calibration is not turned off, just take the voltage values
for jj = app.SelectedChannels
app.calibratedData(:,jj) = (app.data(:,jj));
end
end
% checking too put the app back into configuration @ the end of the
% Store continuous acquisition data in FIFO data buffers
buffersize = round(app.DAQ.Rate * app.TimewindowEditField.Value) + 1;
app.TimestampsFIFOBuffer = storeDataInFIFO(app, app.TimestampsFIFOBuffer, buffersize, timestamps);
app.DataFIFOBufferch1 = storeDataInFIFO(app, app.DataFIFOBufferch1, buffersize, app.calibratedData(:,app.SelectedChannels));
% Plotting (Update the plot every N data points received
updatePlotInterval = 1; % Adjust this value based on your preference
if mod(src.ScansAvailableFcnCount, updatePlotInterval) == 0
% runs function that is responsible for plotting a singular
% graph
updateLivePlot(app);
end
% for data that goes to the workspace and
for ii = 1:(round(app.RateEdit.Value/10))
% keep count of the sample#/time
app.fws_x = app.fws_x + 1;
% initialize data to be written into the workspace
app.fwsdata(app.fws_x,(app.SelectedChannels)) = app.calibratedData(ii,app.SelectedChannels);
end
disp(app.fws_x)
if app.ContinuousSwitch.Value == "Off"
lengthcheck = (app.TrialLengthsEditField.Value* app.RateEdit.Value);
disp(lengthcheck)
if app.fws_x >= lengthcheck
if app.LogRequested
try
% Change the data to a timetable
WSData = array2timetable(app.fwsdata(1:app.TrialLengthsEditField.Value*app.DAQ.Rate,app.SelectedChannels),’SampleRate’,app.RateEdit.Value);
varname = table2array(app.UITable.Data(:,1));
% renames the variable names to match the channel names
for i = app.SelectedChannels
WSData = renamevars(WSData,i,varname(i));
end
% write into base workspace with the name stated in the UI
assignin(‘base’, app.VariableNameEditField.Value, WSData);
assignin("base","variable_name",app.VariableNameEditField.Value)
catch exception
uialert(app.LiveDataAcquisitionUIFigure,exception.message,’You cannot start the variable name with a number’)
end
end
setAppViewState(app, ‘configuration’);
end
end
app.numscan = app.numscan + 1;
end
And the following is what initiates the callback
function StartButtonPushed(app, event)
% so the app can go back into "configuration state"
app.fws_x = 0;
app.fwsdata = 0;
app.wstimestamps= 0;
% clearing the graphs just helps with mainly tab 2 when the
% user is switching where a channels goes (between the 2
% graphs)
cla(app.LiveAxes)
if numel(app.SelectedChannels) == 0
warndlg(‘Please select Channels to record’,’No Channels to Record from Selected’)
else
% dur = isinteger(app.DAQ.Rate/10);
% Disable DAQ device, channel properties, and start acquisition UI components
setAppViewState(app, ‘acquisition’);
% Reset FIFO buffer data
app.calibratedData = [];
app.DataFIFOBufferch1 = [];
app.TimestampsFIFOBuffer = [];
% Checks to see if the app is set to continuous or has a the
% User selected to use a recording window instead
if app.continuous == true
% preallocate for the data that is to be written for
% the workspace
app.fwsdata = zeros(400000,numel(app.numchan));
try
% starts data collection
start(app.DAQ,’continuous’);
catch exception
% In case of error show it and revert the change
uialert(app.LiveDataAcquisitionUIFigure, exception.message, ‘Start error, you may have selected channels too quick!’);
setAppViewState(app, ‘configuration’);
end
else
% preallocate for the data that is to be written for
% the workspace based on the trial length and the
% sample rate
app.fwsdata = zeros((app.RateEdit.Value*app.TrialLengthsEditField.Value),numel(app.numchan));
try
start(app.DAQ,"Duration",app.TrialLengthsEditField.Value)
catch exception
% In case of error show it and revert the change
uialert(app.LiveDataAcquisitionUIFigure, exception.message, ‘Start error’);
setAppViewState(app, ‘configuration’);
end
end
% Clear Log status text
app.LogStatusText.Text = ”;
end Hi all,
I have been having issues setting my sampling rate/ DAQ.Rate to the values 2048 and 120. I am using a start function that is set for x amount of seconds. This then triggers the scansavailablecallback and within this callback it will readout about 1 tenth of the values to be graphed out over time. When setting the DAQ’s Rate to 2048 is collects in sample batches of 205, this leaves the sample batch for 0.9s to 1.0s missing 2 samples and does not end up triggering final 0.1s of the callback. I am not too sure why it does this and am wondering if using the scansavailable callback is part of the issue. I have tried to change the DAQ rate for the 0.9-1.0s time to then activate the callback again but this does not seem to work. A similiar issue happens for 120 where it’s sample batch seems to be 13 which I am quite confused by. Any ideas or guidance on how to go about solving these issues would be greatly appreciated.
This is the callback function
function scansAvailable_Callback(app, src, ~)
% Callback function executed on DAQ object ScansAvailable event
% runs after the start button pushed event is complete
if ~isvalid(app)
return
end
disp (app.numscan)
% Read data from the DAQ object
% Read data from the DAQ object
[app.data, timestamps] = read(src,app.DAQ.ScansAvailableFcnCount, ‘OutputFormat’,’Matrix’);
test = [timestamps,app.data];
assignin("base","test",test)
% Calibration
if app.calibrate == true
% sends data to function to be calibrated appropriately
app.calibratedData = calibrateData(app,app.data, app.sl, app.int);
else
% if calibration is not turned off, just take the voltage values
for jj = app.SelectedChannels
app.calibratedData(:,jj) = (app.data(:,jj));
end
end
% checking too put the app back into configuration @ the end of the
% Store continuous acquisition data in FIFO data buffers
buffersize = round(app.DAQ.Rate * app.TimewindowEditField.Value) + 1;
app.TimestampsFIFOBuffer = storeDataInFIFO(app, app.TimestampsFIFOBuffer, buffersize, timestamps);
app.DataFIFOBufferch1 = storeDataInFIFO(app, app.DataFIFOBufferch1, buffersize, app.calibratedData(:,app.SelectedChannels));
% Plotting (Update the plot every N data points received
updatePlotInterval = 1; % Adjust this value based on your preference
if mod(src.ScansAvailableFcnCount, updatePlotInterval) == 0
% runs function that is responsible for plotting a singular
% graph
updateLivePlot(app);
end
% for data that goes to the workspace and
for ii = 1:(round(app.RateEdit.Value/10))
% keep count of the sample#/time
app.fws_x = app.fws_x + 1;
% initialize data to be written into the workspace
app.fwsdata(app.fws_x,(app.SelectedChannels)) = app.calibratedData(ii,app.SelectedChannels);
end
disp(app.fws_x)
if app.ContinuousSwitch.Value == "Off"
lengthcheck = (app.TrialLengthsEditField.Value* app.RateEdit.Value);
disp(lengthcheck)
if app.fws_x >= lengthcheck
if app.LogRequested
try
% Change the data to a timetable
WSData = array2timetable(app.fwsdata(1:app.TrialLengthsEditField.Value*app.DAQ.Rate,app.SelectedChannels),’SampleRate’,app.RateEdit.Value);
varname = table2array(app.UITable.Data(:,1));
% renames the variable names to match the channel names
for i = app.SelectedChannels
WSData = renamevars(WSData,i,varname(i));
end
% write into base workspace with the name stated in the UI
assignin(‘base’, app.VariableNameEditField.Value, WSData);
assignin("base","variable_name",app.VariableNameEditField.Value)
catch exception
uialert(app.LiveDataAcquisitionUIFigure,exception.message,’You cannot start the variable name with a number’)
end
end
setAppViewState(app, ‘configuration’);
end
end
app.numscan = app.numscan + 1;
end
And the following is what initiates the callback
function StartButtonPushed(app, event)
% so the app can go back into "configuration state"
app.fws_x = 0;
app.fwsdata = 0;
app.wstimestamps= 0;
% clearing the graphs just helps with mainly tab 2 when the
% user is switching where a channels goes (between the 2
% graphs)
cla(app.LiveAxes)
if numel(app.SelectedChannels) == 0
warndlg(‘Please select Channels to record’,’No Channels to Record from Selected’)
else
% dur = isinteger(app.DAQ.Rate/10);
% Disable DAQ device, channel properties, and start acquisition UI components
setAppViewState(app, ‘acquisition’);
% Reset FIFO buffer data
app.calibratedData = [];
app.DataFIFOBufferch1 = [];
app.TimestampsFIFOBuffer = [];
% Checks to see if the app is set to continuous or has a the
% User selected to use a recording window instead
if app.continuous == true
% preallocate for the data that is to be written for
% the workspace
app.fwsdata = zeros(400000,numel(app.numchan));
try
% starts data collection
start(app.DAQ,’continuous’);
catch exception
% In case of error show it and revert the change
uialert(app.LiveDataAcquisitionUIFigure, exception.message, ‘Start error, you may have selected channels too quick!’);
setAppViewState(app, ‘configuration’);
end
else
% preallocate for the data that is to be written for
% the workspace based on the trial length and the
% sample rate
app.fwsdata = zeros((app.RateEdit.Value*app.TrialLengthsEditField.Value),numel(app.numchan));
try
start(app.DAQ,"Duration",app.TrialLengthsEditField.Value)
catch exception
% In case of error show it and revert the change
uialert(app.LiveDataAcquisitionUIFigure, exception.message, ‘Start error’);
setAppViewState(app, ‘configuration’);
end
end
% Clear Log status text
app.LogStatusText.Text = ”;
end data acquisition, toolbox, graph, callback, appdesigner, app designer MATLAB Answers — New Questions
I Just Want To Read Text From URL And Save It As Txt…. But How?
Hello, Community
I just want to ask about how to read text data from URL and save it as ASCII / .Txt Data. It maybe a simple question for all of you, but it kinda so difficult for me…
So i have a data from URL like this :
2024 05 21 33744 33744.5 2602 4 1.667 1.000 1.000 2.667 2.667 2.333 1.667 1.667 6 4 4 12 12 9 6 6 7 165 190.8 195.4 0 2024 05 22 33745 33745.5 2602 5 1.667 0.667 0.333 0.333 0.000 0.667 1.333 1.333 6 3 2 2 0 3 5 5 3 152 195.7 200.6 0 2024 05 23 33746 33746.5 2602 6 0.667 1.667 1.667 2.333 2.333 1.667 2.333 4.000 3 6 6 9 9 6 9 27 9 134 176.2 180.7 0 2024 05 24 33747 33747.5 2602 7 2.000 3.000 2.667 3.000 2.000 1.333 0.333 1.333 7 15 12 15 7 5 2 5 8 126 162.8 167.0 0 2024 05 25 33748 33748.5 2602 8 1.667 1.333 1.333 0.667 0.667 1.667 1.333 2.333 6 5 5 3 3 6 5 9 5 104 152.4 156.4 0 2024 05 26 33749 33749.5 2602 9 1.333 2.333 1.000 2.000 2.667 2.667 2.667 1.000 5 9 4 7 12 12 12 4 8 120 155.6 159.7 0
Or like this in the image of the source:
The data result of webread function is just like this :
textweb = webread("https://kp.gfz-potsdam.de/kpdata?startdate=2024-05-21&enddate=2024-05-26&format=kp1#kpdatadownload-143");
textweb =
‘2024 05 21 33744 33744.5 2602 4 1.667 1.000 1.000 2.667 2.667 2.333 1.667 1.667 6 4 4 12 12 9 6 6 7 165 190.8 195.4 0
2024 05 22 33745 33745.5 2602 5 1.667 0.667 0.333 0.333 0.000 0.667 1.333 1.333 6 3 2 2 0 3 5 5 3 152 195.7 200.6 0
2024 05 23 33746 33746.5 2602 6 0.667 1.667 1.667 2.333 2.333 1.667 2.333 4.000 3 6 6 9 9 6 9 27 9 134 176.2 180.7 0
2024 05 24 33747 33747.5 2602 7 2.000 3.000 2.667 3.000 2.000 1.333 0.333 1.333 7 15 12 15 7 5 2 5 8 126 162.8 167.0 0
2024 05 25 33748 33748.5 2602 8 1.667 1.333 1.333 0.667 0.667 1.667 1.333 2.333 6 5 5 3 3 6 5 9 5 104 152.4 156.4 0
2024 05 26 33749 33749.5 2602 9 1.333 2.333 1.000 2.000 2.667 2.667 2.667 1.000 5 9 4 7 12 12 12 4 8 120 155.6 159.7 0
‘
And i want to know how to convert the output of webread function above to become a data like this :
"2024 05 21 33744 33744.5 2602 4 1.667 1.000 1.000 2.667 2.667 2.333 1.667 1.667 6 4 4 12 12 9 6 6 7 165 190.8 195.4 0"
"2024 05 22 33745 33745.5 2602 5 1.667 0.667 0.333 0.333 0.000 0.667 1.333 1.333 6 3 2 2 0 3 5 5 3 152 195.7 200.6 0"
"2024 05 23 33746 33746.5 2602 6 0.667 1.667 1.667 2.333 2.333 1.667 2.333 4.000 3 6 6 9 9 6 9 27 9 134 176.2 180.7 0"
"2024 05 24 33747 33747.5 2602 7 2.000 3.000 2.667 3.000 2.000 1.333 0.333 1.333 7 15 12 15 7 5 2 5 8 126 162.8 167.0 0"
"2024 05 25 33748 33748.5 2602 8 1.667 1.333 1.333 0.667 0.667 1.667 1.333 2.333 6 5 5 3 3 6 5 9 5 104 152.4 156.4 0"
"2024 05 26 33749 33749.5 2602 9 1.333 2.333 1.000 2.000 2.667 2.667 2.667 1.000 5 9 4 7 12 12 12 4 8 120 155.6 159.7 0"
OR just simply save the output of webread function to become a txt file (ASCII) which can be opened in my local PC…
Thank you everyone for your attention and cooperation. I would be very grateful if community can help me to solve this problem /. /. /.Hello, Community
I just want to ask about how to read text data from URL and save it as ASCII / .Txt Data. It maybe a simple question for all of you, but it kinda so difficult for me…
So i have a data from URL like this :
2024 05 21 33744 33744.5 2602 4 1.667 1.000 1.000 2.667 2.667 2.333 1.667 1.667 6 4 4 12 12 9 6 6 7 165 190.8 195.4 0 2024 05 22 33745 33745.5 2602 5 1.667 0.667 0.333 0.333 0.000 0.667 1.333 1.333 6 3 2 2 0 3 5 5 3 152 195.7 200.6 0 2024 05 23 33746 33746.5 2602 6 0.667 1.667 1.667 2.333 2.333 1.667 2.333 4.000 3 6 6 9 9 6 9 27 9 134 176.2 180.7 0 2024 05 24 33747 33747.5 2602 7 2.000 3.000 2.667 3.000 2.000 1.333 0.333 1.333 7 15 12 15 7 5 2 5 8 126 162.8 167.0 0 2024 05 25 33748 33748.5 2602 8 1.667 1.333 1.333 0.667 0.667 1.667 1.333 2.333 6 5 5 3 3 6 5 9 5 104 152.4 156.4 0 2024 05 26 33749 33749.5 2602 9 1.333 2.333 1.000 2.000 2.667 2.667 2.667 1.000 5 9 4 7 12 12 12 4 8 120 155.6 159.7 0
Or like this in the image of the source:
The data result of webread function is just like this :
textweb = webread("https://kp.gfz-potsdam.de/kpdata?startdate=2024-05-21&enddate=2024-05-26&format=kp1#kpdatadownload-143");
textweb =
‘2024 05 21 33744 33744.5 2602 4 1.667 1.000 1.000 2.667 2.667 2.333 1.667 1.667 6 4 4 12 12 9 6 6 7 165 190.8 195.4 0
2024 05 22 33745 33745.5 2602 5 1.667 0.667 0.333 0.333 0.000 0.667 1.333 1.333 6 3 2 2 0 3 5 5 3 152 195.7 200.6 0
2024 05 23 33746 33746.5 2602 6 0.667 1.667 1.667 2.333 2.333 1.667 2.333 4.000 3 6 6 9 9 6 9 27 9 134 176.2 180.7 0
2024 05 24 33747 33747.5 2602 7 2.000 3.000 2.667 3.000 2.000 1.333 0.333 1.333 7 15 12 15 7 5 2 5 8 126 162.8 167.0 0
2024 05 25 33748 33748.5 2602 8 1.667 1.333 1.333 0.667 0.667 1.667 1.333 2.333 6 5 5 3 3 6 5 9 5 104 152.4 156.4 0
2024 05 26 33749 33749.5 2602 9 1.333 2.333 1.000 2.000 2.667 2.667 2.667 1.000 5 9 4 7 12 12 12 4 8 120 155.6 159.7 0
‘
And i want to know how to convert the output of webread function above to become a data like this :
"2024 05 21 33744 33744.5 2602 4 1.667 1.000 1.000 2.667 2.667 2.333 1.667 1.667 6 4 4 12 12 9 6 6 7 165 190.8 195.4 0"
"2024 05 22 33745 33745.5 2602 5 1.667 0.667 0.333 0.333 0.000 0.667 1.333 1.333 6 3 2 2 0 3 5 5 3 152 195.7 200.6 0"
"2024 05 23 33746 33746.5 2602 6 0.667 1.667 1.667 2.333 2.333 1.667 2.333 4.000 3 6 6 9 9 6 9 27 9 134 176.2 180.7 0"
"2024 05 24 33747 33747.5 2602 7 2.000 3.000 2.667 3.000 2.000 1.333 0.333 1.333 7 15 12 15 7 5 2 5 8 126 162.8 167.0 0"
"2024 05 25 33748 33748.5 2602 8 1.667 1.333 1.333 0.667 0.667 1.667 1.333 2.333 6 5 5 3 3 6 5 9 5 104 152.4 156.4 0"
"2024 05 26 33749 33749.5 2602 9 1.333 2.333 1.000 2.000 2.667 2.667 2.667 1.000 5 9 4 7 12 12 12 4 8 120 155.6 159.7 0"
OR just simply save the output of webread function to become a txt file (ASCII) which can be opened in my local PC…
Thank you everyone for your attention and cooperation. I would be very grateful if community can help me to solve this problem /. /. /. Hello, Community
I just want to ask about how to read text data from URL and save it as ASCII / .Txt Data. It maybe a simple question for all of you, but it kinda so difficult for me…
So i have a data from URL like this :
2024 05 21 33744 33744.5 2602 4 1.667 1.000 1.000 2.667 2.667 2.333 1.667 1.667 6 4 4 12 12 9 6 6 7 165 190.8 195.4 0 2024 05 22 33745 33745.5 2602 5 1.667 0.667 0.333 0.333 0.000 0.667 1.333 1.333 6 3 2 2 0 3 5 5 3 152 195.7 200.6 0 2024 05 23 33746 33746.5 2602 6 0.667 1.667 1.667 2.333 2.333 1.667 2.333 4.000 3 6 6 9 9 6 9 27 9 134 176.2 180.7 0 2024 05 24 33747 33747.5 2602 7 2.000 3.000 2.667 3.000 2.000 1.333 0.333 1.333 7 15 12 15 7 5 2 5 8 126 162.8 167.0 0 2024 05 25 33748 33748.5 2602 8 1.667 1.333 1.333 0.667 0.667 1.667 1.333 2.333 6 5 5 3 3 6 5 9 5 104 152.4 156.4 0 2024 05 26 33749 33749.5 2602 9 1.333 2.333 1.000 2.000 2.667 2.667 2.667 1.000 5 9 4 7 12 12 12 4 8 120 155.6 159.7 0
Or like this in the image of the source:
The data result of webread function is just like this :
textweb = webread("https://kp.gfz-potsdam.de/kpdata?startdate=2024-05-21&enddate=2024-05-26&format=kp1#kpdatadownload-143");
textweb =
‘2024 05 21 33744 33744.5 2602 4 1.667 1.000 1.000 2.667 2.667 2.333 1.667 1.667 6 4 4 12 12 9 6 6 7 165 190.8 195.4 0
2024 05 22 33745 33745.5 2602 5 1.667 0.667 0.333 0.333 0.000 0.667 1.333 1.333 6 3 2 2 0 3 5 5 3 152 195.7 200.6 0
2024 05 23 33746 33746.5 2602 6 0.667 1.667 1.667 2.333 2.333 1.667 2.333 4.000 3 6 6 9 9 6 9 27 9 134 176.2 180.7 0
2024 05 24 33747 33747.5 2602 7 2.000 3.000 2.667 3.000 2.000 1.333 0.333 1.333 7 15 12 15 7 5 2 5 8 126 162.8 167.0 0
2024 05 25 33748 33748.5 2602 8 1.667 1.333 1.333 0.667 0.667 1.667 1.333 2.333 6 5 5 3 3 6 5 9 5 104 152.4 156.4 0
2024 05 26 33749 33749.5 2602 9 1.333 2.333 1.000 2.000 2.667 2.667 2.667 1.000 5 9 4 7 12 12 12 4 8 120 155.6 159.7 0
‘
And i want to know how to convert the output of webread function above to become a data like this :
"2024 05 21 33744 33744.5 2602 4 1.667 1.000 1.000 2.667 2.667 2.333 1.667 1.667 6 4 4 12 12 9 6 6 7 165 190.8 195.4 0"
"2024 05 22 33745 33745.5 2602 5 1.667 0.667 0.333 0.333 0.000 0.667 1.333 1.333 6 3 2 2 0 3 5 5 3 152 195.7 200.6 0"
"2024 05 23 33746 33746.5 2602 6 0.667 1.667 1.667 2.333 2.333 1.667 2.333 4.000 3 6 6 9 9 6 9 27 9 134 176.2 180.7 0"
"2024 05 24 33747 33747.5 2602 7 2.000 3.000 2.667 3.000 2.000 1.333 0.333 1.333 7 15 12 15 7 5 2 5 8 126 162.8 167.0 0"
"2024 05 25 33748 33748.5 2602 8 1.667 1.333 1.333 0.667 0.667 1.667 1.333 2.333 6 5 5 3 3 6 5 9 5 104 152.4 156.4 0"
"2024 05 26 33749 33749.5 2602 9 1.333 2.333 1.000 2.000 2.667 2.667 2.667 1.000 5 9 4 7 12 12 12 4 8 120 155.6 159.7 0"
OR just simply save the output of webread function to become a txt file (ASCII) which can be opened in my local PC…
Thank you everyone for your attention and cooperation. I would be very grateful if community can help me to solve this problem /. /. /. read webdata as text MATLAB Answers — New Questions
Turn sequence into a loop
idler_1 = 17;
idler_2 = 17;
idler_3 = 17;
Z_gears(1) = 17;
% Z_gear(1) is defined same holds for the idler’s
% Number of Z_gears is determined by N and gear_ratio_combo goes from (1,1)
% to (1,(columlength)
% idlers are on Z_gear place Z_gear(3),Z_gear(5),Z_gear(7) etc
% but if Z_gear(end) is uneven then do not place idler there
Z_gears(2) = Z_gears(1)*gear_ratio_combo(1,1);
Z_gears(3) = idler_1;
Z_gears(4) = Z_gears(3)*gear_ratio_combo(1,2);
Z_gears(5) = idler_2;
Z_gears(6) = Z_gears(5)*gear_ratio_combo(1,3);
Z_gears(7) = idler_3;
Z_gears(8) = Z_gears(7)*gear_ratio_combo(1,4);idler_1 = 17;
idler_2 = 17;
idler_3 = 17;
Z_gears(1) = 17;
% Z_gear(1) is defined same holds for the idler’s
% Number of Z_gears is determined by N and gear_ratio_combo goes from (1,1)
% to (1,(columlength)
% idlers are on Z_gear place Z_gear(3),Z_gear(5),Z_gear(7) etc
% but if Z_gear(end) is uneven then do not place idler there
Z_gears(2) = Z_gears(1)*gear_ratio_combo(1,1);
Z_gears(3) = idler_1;
Z_gears(4) = Z_gears(3)*gear_ratio_combo(1,2);
Z_gears(5) = idler_2;
Z_gears(6) = Z_gears(5)*gear_ratio_combo(1,3);
Z_gears(7) = idler_3;
Z_gears(8) = Z_gears(7)*gear_ratio_combo(1,4); idler_1 = 17;
idler_2 = 17;
idler_3 = 17;
Z_gears(1) = 17;
% Z_gear(1) is defined same holds for the idler’s
% Number of Z_gears is determined by N and gear_ratio_combo goes from (1,1)
% to (1,(columlength)
% idlers are on Z_gear place Z_gear(3),Z_gear(5),Z_gear(7) etc
% but if Z_gear(end) is uneven then do not place idler there
Z_gears(2) = Z_gears(1)*gear_ratio_combo(1,1);
Z_gears(3) = idler_1;
Z_gears(4) = Z_gears(3)*gear_ratio_combo(1,2);
Z_gears(5) = idler_2;
Z_gears(6) = Z_gears(5)*gear_ratio_combo(1,3);
Z_gears(7) = idler_3;
Z_gears(8) = Z_gears(7)*gear_ratio_combo(1,4); sequences, for loop MATLAB Answers — New Questions
Having problems with the trainnet function
I am trying to fine tune a machine learning model. While using the trainnet function it states "Training stopped: Training loss is NaN" in the command window. The old trainNetwork functions works, which to me makes it weird that trainnet does not. How do I work around this? Possible solutions?I am trying to fine tune a machine learning model. While using the trainnet function it states "Training stopped: Training loss is NaN" in the command window. The old trainNetwork functions works, which to me makes it weird that trainnet does not. How do I work around this? Possible solutions? I am trying to fine tune a machine learning model. While using the trainnet function it states "Training stopped: Training loss is NaN" in the command window. The old trainNetwork functions works, which to me makes it weird that trainnet does not. How do I work around this? Possible solutions? machine learning, image processing MATLAB Answers — New Questions
how aggregate duraration and sum it in timetable
Hi,
it’s a timetable and i want to sum all duration equal:
example:
04/01/2010 2202 1.23
05/01/2010 2202 1.26
……
i want this:
duration value
22:02 2.49 (1.23+1.26)Hi,
it’s a timetable and i want to sum all duration equal:
example:
04/01/2010 2202 1.23
05/01/2010 2202 1.26
……
i want this:
duration value
22:02 2.49 (1.23+1.26) Hi,
it’s a timetable and i want to sum all duration equal:
example:
04/01/2010 2202 1.23
05/01/2010 2202 1.26
……
i want this:
duration value
22:02 2.49 (1.23+1.26) how aggregate duraration and sum it in timetable MATLAB Answers — New Questions
How to resolve the error for creating mask from shape file?
I am using following MATLAB code to create mask using shape file
S = shaperead(shapefile.name);
% Shapefile projections
info = shapeinfo(shapefile.name);
crs = info.CoordinateReferenceSystem;
[S(1).lon,S(1).lat] = projinv(crs,S(1).X,S(1).Y);
%remove small triangles and squares
coord_lengths = arrayfun(@(s) numel(s.X), S);
not_useful_mask = coord_lengths < 10;
S(not_useful_mask) = [];
polygon = polyshape({S(1).lon}, {S(1).lat});
[Z,R] = readgeoraster(‘C:workndvi_2022_23.dat’);
p = R.ProjectedCRS;
[x,y] = worldGrid(R);
[lon,lat] = projinv(p,x,y);
% Create a logical mask
logical_mask = reshape(isinterior(polygon, lon(:), lat(:)), size(lon));
However, it is giving following error;
Ale.shp
Warning: Polyshape has duplicate vertices, intersections, or other inconsistencies that may produce inaccurate or
unexpected results. Input data has been modified to create a well-defined polyshape.
> In polyshape/checkAndSimplify (line 526)
In polyshape (line 175)
In indices_caf (line 45)
Requested 408×5604579 (17.0GB) array exceeds maximum array size preference (15.8GB). This might cause MATLAB to
become unresponsive.
Error in polyshape/isinterior>check_inpolygon (line 65)
x = x(ones(Nv,1),:);
Error in polyshape/isinterior (line 50)
[in, on] = check_inpolygon(X, Y, xv, yv, tol);
Error in indices_caf (line 53)
logical_mask = reshape(isinterior(polygon, lon(:), lat(:)), size(lon));
shape file is attached as zip file while data file is uploaded on following link;
https://drive.google.com/file/d/1aqMYMJDlMOXvamybP-i6eiuo5ehYzdkh/view?usp=sharing
I would appreciate any help.I am using following MATLAB code to create mask using shape file
S = shaperead(shapefile.name);
% Shapefile projections
info = shapeinfo(shapefile.name);
crs = info.CoordinateReferenceSystem;
[S(1).lon,S(1).lat] = projinv(crs,S(1).X,S(1).Y);
%remove small triangles and squares
coord_lengths = arrayfun(@(s) numel(s.X), S);
not_useful_mask = coord_lengths < 10;
S(not_useful_mask) = [];
polygon = polyshape({S(1).lon}, {S(1).lat});
[Z,R] = readgeoraster(‘C:workndvi_2022_23.dat’);
p = R.ProjectedCRS;
[x,y] = worldGrid(R);
[lon,lat] = projinv(p,x,y);
% Create a logical mask
logical_mask = reshape(isinterior(polygon, lon(:), lat(:)), size(lon));
However, it is giving following error;
Ale.shp
Warning: Polyshape has duplicate vertices, intersections, or other inconsistencies that may produce inaccurate or
unexpected results. Input data has been modified to create a well-defined polyshape.
> In polyshape/checkAndSimplify (line 526)
In polyshape (line 175)
In indices_caf (line 45)
Requested 408×5604579 (17.0GB) array exceeds maximum array size preference (15.8GB). This might cause MATLAB to
become unresponsive.
Error in polyshape/isinterior>check_inpolygon (line 65)
x = x(ones(Nv,1),:);
Error in polyshape/isinterior (line 50)
[in, on] = check_inpolygon(X, Y, xv, yv, tol);
Error in indices_caf (line 53)
logical_mask = reshape(isinterior(polygon, lon(:), lat(:)), size(lon));
shape file is attached as zip file while data file is uploaded on following link;
https://drive.google.com/file/d/1aqMYMJDlMOXvamybP-i6eiuo5ehYzdkh/view?usp=sharing
I would appreciate any help. I am using following MATLAB code to create mask using shape file
S = shaperead(shapefile.name);
% Shapefile projections
info = shapeinfo(shapefile.name);
crs = info.CoordinateReferenceSystem;
[S(1).lon,S(1).lat] = projinv(crs,S(1).X,S(1).Y);
%remove small triangles and squares
coord_lengths = arrayfun(@(s) numel(s.X), S);
not_useful_mask = coord_lengths < 10;
S(not_useful_mask) = [];
polygon = polyshape({S(1).lon}, {S(1).lat});
[Z,R] = readgeoraster(‘C:workndvi_2022_23.dat’);
p = R.ProjectedCRS;
[x,y] = worldGrid(R);
[lon,lat] = projinv(p,x,y);
% Create a logical mask
logical_mask = reshape(isinterior(polygon, lon(:), lat(:)), size(lon));
However, it is giving following error;
Ale.shp
Warning: Polyshape has duplicate vertices, intersections, or other inconsistencies that may produce inaccurate or
unexpected results. Input data has been modified to create a well-defined polyshape.
> In polyshape/checkAndSimplify (line 526)
In polyshape (line 175)
In indices_caf (line 45)
Requested 408×5604579 (17.0GB) array exceeds maximum array size preference (15.8GB). This might cause MATLAB to
become unresponsive.
Error in polyshape/isinterior>check_inpolygon (line 65)
x = x(ones(Nv,1),:);
Error in polyshape/isinterior (line 50)
[in, on] = check_inpolygon(X, Y, xv, yv, tol);
Error in indices_caf (line 53)
logical_mask = reshape(isinterior(polygon, lon(:), lat(:)), size(lon));
shape file is attached as zip file while data file is uploaded on following link;
https://drive.google.com/file/d/1aqMYMJDlMOXvamybP-i6eiuo5ehYzdkh/view?usp=sharing
I would appreciate any help. how to resolve the error for creating mask from s MATLAB Answers — New Questions
Matlab Predict function is not efficient
Matlab Predict function is not efficient…Perhaps because it is general suitable for all models. Is there a way to speed it? I am working with incremental regression kernel. Predict takes more time than updatemetricsandfit!Matlab Predict function is not efficient…Perhaps because it is general suitable for all models. Is there a way to speed it? I am working with incremental regression kernel. Predict takes more time than updatemetricsandfit! Matlab Predict function is not efficient…Perhaps because it is general suitable for all models. Is there a way to speed it? I am working with incremental regression kernel. Predict takes more time than updatemetricsandfit! efficient MATLAB Answers — New Questions
How to use the attached excel file below to do a Fourier conversion and display the spectrogram?
How do I use the attached excel file below to do a Fourier conversion and display the spectrogram?How do I use the attached excel file below to do a Fourier conversion and display the spectrogram? How do I use the attached excel file below to do a Fourier conversion and display the spectrogram? fourier conversion and display the spectrogram MATLAB Answers — New Questions
Magnitude and phase of the signal using cwt
Hi,
I have a signal in time that I want to analize in the frequency domain using wavelet transform (to balance time and frequency resolution). When I check the magnitude scalogram that is automatically generated using the function cwt, the value of the magnitude that i read is somehow corresponding to the value I am expecting from the time signal. When I try to extract this values computing abs and angle of the coefficients I get from cwt and compare them with expected magnitude and phase, I see there is some scaling factor. I tried to play with the sampling frequency, and it seems to be dependent also on this, but I could not figure out looking into the documentation how to get rid of this scaling factor.
coefs = cwt(signal, scales, wavelet);
mag=abs(coefs);
ph=angle(coefs);
I am taking the magnitude and phase at the freqeuncy where I have the peak, of course, using max(). That’s the one I want to extract.Hi,
I have a signal in time that I want to analize in the frequency domain using wavelet transform (to balance time and frequency resolution). When I check the magnitude scalogram that is automatically generated using the function cwt, the value of the magnitude that i read is somehow corresponding to the value I am expecting from the time signal. When I try to extract this values computing abs and angle of the coefficients I get from cwt and compare them with expected magnitude and phase, I see there is some scaling factor. I tried to play with the sampling frequency, and it seems to be dependent also on this, but I could not figure out looking into the documentation how to get rid of this scaling factor.
coefs = cwt(signal, scales, wavelet);
mag=abs(coefs);
ph=angle(coefs);
I am taking the magnitude and phase at the freqeuncy where I have the peak, of course, using max(). That’s the one I want to extract. Hi,
I have a signal in time that I want to analize in the frequency domain using wavelet transform (to balance time and frequency resolution). When I check the magnitude scalogram that is automatically generated using the function cwt, the value of the magnitude that i read is somehow corresponding to the value I am expecting from the time signal. When I try to extract this values computing abs and angle of the coefficients I get from cwt and compare them with expected magnitude and phase, I see there is some scaling factor. I tried to play with the sampling frequency, and it seems to be dependent also on this, but I could not figure out looking into the documentation how to get rid of this scaling factor.
coefs = cwt(signal, scales, wavelet);
mag=abs(coefs);
ph=angle(coefs);
I am taking the magnitude and phase at the freqeuncy where I have the peak, of course, using max(). That’s the one I want to extract. wavelet transform, cwt, magnitude, phase, signal in time domain MATLAB Answers — New Questions
Using lookup table with continuous signal
Hi, I’m trying to use LookUpTables with Breakpoints from 0 to 2*pi with input signals that can range from -inf to inf. Since the relationship between the input and output is continuous and repeats, I tried using the MatLab functions WrapTo2Pi() and Unwrap(). Although the LookUpTable combined with WrapTo2Pi() delivers the expected result, I have not found a way to convert the output signal from the table back into a continuous signal without jumps.
I assume that Unwarp() does not work as it only receives one Signal value at a time, and is not able to detect signal jumps because of it. Is there a similar function in Simulink that i could use instead?Hi, I’m trying to use LookUpTables with Breakpoints from 0 to 2*pi with input signals that can range from -inf to inf. Since the relationship between the input and output is continuous and repeats, I tried using the MatLab functions WrapTo2Pi() and Unwrap(). Although the LookUpTable combined with WrapTo2Pi() delivers the expected result, I have not found a way to convert the output signal from the table back into a continuous signal without jumps.
I assume that Unwarp() does not work as it only receives one Signal value at a time, and is not able to detect signal jumps because of it. Is there a similar function in Simulink that i could use instead? Hi, I’m trying to use LookUpTables with Breakpoints from 0 to 2*pi with input signals that can range from -inf to inf. Since the relationship between the input and output is continuous and repeats, I tried using the MatLab functions WrapTo2Pi() and Unwrap(). Although the LookUpTable combined with WrapTo2Pi() delivers the expected result, I have not found a way to convert the output signal from the table back into a continuous signal without jumps.
I assume that Unwarp() does not work as it only receives one Signal value at a time, and is not able to detect signal jumps because of it. Is there a similar function in Simulink that i could use instead? lookuptable, simulink MATLAB Answers — New Questions
retrieve version inside AppDesigner appplication (.mlapp file)
Does anyone know how to retrieve (programmatically) the version inside an .mlapp file?
This property is available on top level of the GUI, in picture below it is 1.02. I’d like to display it in a text label in the app.Does anyone know how to retrieve (programmatically) the version inside an .mlapp file?
This property is available on top level of the GUI, in picture below it is 1.02. I’d like to display it in a text label in the app. Does anyone know how to retrieve (programmatically) the version inside an .mlapp file?
This property is available on top level of the GUI, in picture below it is 1.02. I’d like to display it in a text label in the app. appdesigner MATLAB Answers — New Questions
How can I select custom type as parameter type in c-function block?
My main problem is that I want to use a custom device type Q16_t which is declared in a header file q16t.hpp. Because this file inlude several other header files, which also includes headerfile I have a big dependency tree.
In order to trim this problem to an easier starting point, I started with this example:
https://de.mathworks.com/help/simulink/ug/interface-with-c-classes-using-c-function-block.html
I added the source code, include headers and search directories as described in the example, but I am not able to select this class parameter. A picture of all parameter types which I can select is attached.
I tested to import it with Simulink.ImportExternalCTypes but this didn’t have any effect.
I added include header, search directories and source files in C Function block as well as in the model settings simulation target pane to make sure, that files can be found. In model settings simulation target pane the validate custom code is executed without any errors. Did I miss an important setting in advanced parameter menue or anything else?
Any help is appreciated.
Kind regards
SaschaMy main problem is that I want to use a custom device type Q16_t which is declared in a header file q16t.hpp. Because this file inlude several other header files, which also includes headerfile I have a big dependency tree.
In order to trim this problem to an easier starting point, I started with this example:
https://de.mathworks.com/help/simulink/ug/interface-with-c-classes-using-c-function-block.html
I added the source code, include headers and search directories as described in the example, but I am not able to select this class parameter. A picture of all parameter types which I can select is attached.
I tested to import it with Simulink.ImportExternalCTypes but this didn’t have any effect.
I added include header, search directories and source files in C Function block as well as in the model settings simulation target pane to make sure, that files can be found. In model settings simulation target pane the validate custom code is executed without any errors. Did I miss an important setting in advanced parameter menue or anything else?
Any help is appreciated.
Kind regards
Sascha My main problem is that I want to use a custom device type Q16_t which is declared in a header file q16t.hpp. Because this file inlude several other header files, which also includes headerfile I have a big dependency tree.
In order to trim this problem to an easier starting point, I started with this example:
https://de.mathworks.com/help/simulink/ug/interface-with-c-classes-using-c-function-block.html
I added the source code, include headers and search directories as described in the example, but I am not able to select this class parameter. A picture of all parameter types which I can select is attached.
I tested to import it with Simulink.ImportExternalCTypes but this didn’t have any effect.
I added include header, search directories and source files in C Function block as well as in the model settings simulation target pane to make sure, that files can be found. In model settings simulation target pane the validate custom code is executed without any errors. Did I miss an important setting in advanced parameter menue or anything else?
Any help is appreciated.
Kind regards
Sascha c++, integrate_c_code MATLAB Answers — New Questions
Where is the reference ground for the op amplifier in simscape
I want to know what the electrical reference for the op-amplifier is. The output voltage range of a general op-amplifier should be relative to its power supply. But there is actually no defined input power supply for the op-amplifier in Simulink, is the electrical reference the reference ground for the entire system at this time? Will this be a problem in some complex simulation models.
I built a DAB converter that includes an active filter. The op amplifier plays an important role here, but I found that its input end is not dashed. It is confusing.I want to know what the electrical reference for the op-amplifier is. The output voltage range of a general op-amplifier should be relative to its power supply. But there is actually no defined input power supply for the op-amplifier in Simulink, is the electrical reference the reference ground for the entire system at this time? Will this be a problem in some complex simulation models.
I built a DAB converter that includes an active filter. The op amplifier plays an important role here, but I found that its input end is not dashed. It is confusing. I want to know what the electrical reference for the op-amplifier is. The output voltage range of a general op-amplifier should be relative to its power supply. But there is actually no defined input power supply for the op-amplifier in Simulink, is the electrical reference the reference ground for the entire system at this time? Will this be a problem in some complex simulation models.
I built a DAB converter that includes an active filter. The op amplifier plays an important role here, but I found that its input end is not dashed. It is confusing. modelling of op-amplifier, simscape, electrical reference MATLAB Answers — New Questions