Answered
Repeating a function for different values that involves imaginary numbers.
Use ./ instead of / Y = 1./X; The difference is listed here: https://www.mathworks.com/help/matlab/matlab_prog/matlab-operato...

2 years ago | 0

| accepted

Answered
How to partition a matrix by sorting a column?
A= [ 73.90 123.17 1.00; 73.79 121.83 0.00; 70.64 74.46 1.00; 69.74 86.40 0.00] C = splitapply(@(x){x}...

2 years ago | 0

Answered
Remove rows from table with a column match and an undefined categorical
%create result array with undefined categoricals result = [string(missing);"PASS";string(missing);string(missing);"FAIL";"PASS"...

2 years ago | 0

| accepted

Answered
Confused as to where my syntax is incorrect. I am trying to Test the BCD output a function with the test_four_input_gate function and verify it with the BCD documentation.
A1 is not defined (you're missing the A1 loop), and the reason for the error is you didn't supply any input (gate) to test_four_...

2 years ago | 2

| accepted

Answered
how to extract data from Matlab figure with stacked lines?
f = openfig('intensity with lines.fig'); lines = findall(f,'Type','line') xdata = get(lines,'XData'); % xdata: 10x1 cell array...

2 years ago | 0

Answered
Why does the operand '==' not work on type 'cell' for one table but does for the other but both contain the sane type of data
In updatedoc, you convert the UID column of T to numeric before doing the == comparison: T.UID = str2double(T.UID);%convert to ...

2 years ago | 0

| accepted

Answered
How to compute the %age of data lies within the confidance interval?
You have a missing "2" in the calculation of overall_percentage_within_interval2. You're using within_interval_count and you sho...

2 years ago | 0

Answered
Assign variable spend to true or false based on the parameters
profit_mild = 100000; prob_freezing = 0.25; prob_damage = 0.4; damage_reduction = 60000; protection_cost = 5000; mu = (1 - ...

2 years ago | 1

| accepted

Answered
How do I create a cylindrical surface mesh with a changing Z coordinate?
Maybe something like this: t = linspace(0,4); th = t*.25*pi; v = 20+20*(sin(2*t)+1); % speed (i.e., magnitude of velocity) ...

2 years ago | 0

Answered
writetable or dlmwrite to save an array as a txt file
Here's one way: M = [ 1.0000 -26.2000 -31.7000 2.0000 -27.1000 -33.9000 3.0000 -25.5000 -30.2000 4.00...

2 years ago | 0

| accepted

Answered
str2sym error
I get a different error: try S = str2sym('force(t)') catch e disp(e.message); end Anyway, here's a workaround: S ...

2 years ago | 0

| accepted

Answered
Trying to add data pulled from trials subfolders into a table and add a column in that table that labels the data with the trial that is came from
P = uigetdir('C:\user\project1\'); F = fullfile(P,'Trial*','Data','imudata.txt'); S = dir(F); for k = 1:numel(S) ...

2 years ago | 0

| accepted

Answered
Why my code is running but giving wrong values
There are a few places in the code where you use sum on a scalar value. Two of them look like this f15=f14+sum(f13(a,1)); % ...

2 years ago | 1

| accepted

Answered
How to use assert to prevent cell contains thing which is false
assert(~any(strcmp(columnhinge1H2,'B to C')),'Structure collapsed')

2 years ago | 0

| accepted

Answered
How to use and edit rows and values of a data tip when created by mouseclick?
See dataTipTextRow: https://www.mathworks.com/help/matlab/ref/matlab.graphics.datatip.datatiptextrow.html

2 years ago | 0

| accepted

Answered
How can I retrieve those elements by their positions in a matrix?
See sub2ind. For example, I'll use it to construct a matrix like the one you describe. M = NaN(13,9); M(:,[1 4 7]) = rand(13,...

2 years ago | 0

| accepted

Answered
plot binary data over time to specific conditions
load('battstatvector.mat') % a mat file containing a cell array like yours battstatvector figure('Position',[10 10 800 200])...

2 years ago | 0

| accepted

Answered
Creating Infinite Continuous Smooth Sound
In order to avoid that "small intermission" or slight interruption between iterations, the signal must have a smoothly varying p...

2 years ago | 0

Answered
How to move the Yaxis exponent outside
I don't know of a way to move that exponent label, but if you have R2023b or later, you can use the ysecondarylabel function to ...

2 years ago | 1

| accepted

Answered
I am trying to assign a pattern of alphabets to a sequence of alphabets that I have.
seq_file = fopen('insulinDNAseq.txt'); template5_3 = fscanf(seq_file,'%s'); fclose(seq_file); % close the file when you're don...

2 years ago | 0

Answered
How to place a subplot with the same dimensions as ax.width, ax.height and ax.Position
I gather that you want to perform an adjustment to the positions of your axes, increasing the y (bottom) by 0.05 and decreasing ...

2 years ago | 1

| accepted

Answered
How can I multiply a row vector with each of two column vectors?
One way: t = [1 2]; s = [(1:3)',(4:6)']; reshape(t.*s(:),size(s,1),[])

2 years ago | 0

| accepted

Answered
Error with matrix dimensions arithmetic
Sounds like the tutorial is for an older version of MATLAB, and the behavior changed since then. Here is an article related to t...

2 years ago | 1

| accepted

Answered
Manipulate elements in a matrix based on a mathematical condition using logical indexing
Sounds like what you're going for is: condition = abs( A(end,:) - A(1,:) ) < 0.01; A(:,condition) = A(ones(end,1),condit...

2 years ago | 0

| accepted

Answered
Plotting a surface from a timetable
Here's one way: load data X = Lane1Data.("Start Time"); Y = Lane1Data.("Distance [km]"); Z = Lane1Data.("Flow Rate [veh/hr...

2 years ago | 0

| accepted

Answered
Creating a circular contour from radial datasets
S = load('example.mat'); Blades = [S.Blade1 S.Blade2 S.Blade3 S.Blade4 S.Blade5 S.Blade6]; Blades_plot = Blades([1:end 1])...

2 years ago | 2

| accepted

Answered
How can I get my function to make changes to my state button properties?
The basic problem is that the variable edit_inputs is not defined inside the press function. In other words, there is currently ...

2 years ago | 2

| accepted

Answered
Two histogram in one plot
Here's some code that plots two histograms in one figure and saves the figure: % some random data: f1 = 1.2+randn(1,100)/20; ...

2 years ago | 0

| accepted

Answered
App designer - I can't resolve two bugs in my programme
Problem 1: app.media is never set to 5 because in SelectMediaButtonGroupSelectionChanged, you have: elseif app.UserDefinedButto...

2 years ago | 0

| accepted

Answered
Function calling in app designer not working
Seems like app.Giri.Value is a character (which makes sense if it is a 'discrete' uiknob), but you are expecting it to be numeri...

2 years ago | 0

| accepted

Load more