Respondida
How to use str2func with a function handle in the string
From the documentation for str2func, "Workspace variables are not available to the str2func function." See this answer. You ...

alrededor de 4 años hace | 0

| aceptada

Respondida
Finding rows/indices by comparing individual elements of rows of one matrix to another
For less than or equal to: find(all(m1 <= m2, 2)) For less than: find(all(m1 < m2, 2))

alrededor de 4 años hace | 2

| aceptada

Respondida
How to skip lines to execute/run?
return % ? Or have your if block encompass the lines to be skipped and change the condition to the opposite of your condition f...

alrededor de 4 años hace | 1

Respondida
How to design GUI buttons?
You can set the CData of a uicontrol pushbutton: p = uicontrol('Style', 'pushbutton', 'Position', [100, 150, 100, 30], 'String'...

alrededor de 4 años hace | 1

| aceptada

Respondida
How to bold dialog box?
You can tell msgbox, inputdlg, warndlg, errordlg, and questdlg (and maybe others?) to use a tex interpreter. They all default to...

alrededor de 4 años hace | 2

| aceptada

Respondida
How can I extract points (sum of values) from variable size groups of lines (separated from NaN values) in the same column ?
Potentially over-complicated but should work: cA = cumsum([A, B],'omitnan'); idx = [isnan(A(2:end)); 1] & ~isnan(A); C = diff...

alrededor de 4 años hace | 1

Respondida
How to split the data inside the matrix correctly?
Here's another uglier way. C = mat2cell(matrix, diff([0; find(diff(matrix(:,2))); size(matrix,1)]), 2);

alrededor de 4 años hace | 0

| aceptada

Respondida
Using sign function in Matlab
sign(x) returns a matrix the same size as x. If the dimensions of x (and therefore sign(x)) are N-1 x 1 and the dimensions of D2...

alrededor de 4 años hace | 0

Respondida
How to do correlation between each row of two matrices?
The default correlation coefficient which corr calculates is described here (the Pearson linear correlation coefficient): https...

alrededor de 4 años hace | 1

| aceptada

Respondida
how to get cartesian equation from parametric equation
Maybe something like this? syms t x y eqns = [x == 10*t^2; y == 2*t^2]; out = subs(eqns(2), t, rhs(isolate(eqns(1), t))); wh...

alrededor de 4 años hace | 0

| aceptada

Respondida
Input data, round down, loop variable
How does this work? (I'm assuming T.y is monotonically increasing) % example table: x = randi(10,59,1); y = cumsum(rand(59,1)...

alrededor de 4 años hace | 1

| aceptada

Respondida
How do I plot on the same figure from 2 functions?
When you name a variable in your function figure, you can no longer access the function figure(). For example: >> figure = 1; ...

alrededor de 4 años hace | 1

| aceptada

Respondida
How can I remove the error "unable to perform because the indices on the left side are not compatible with the size of the right side"
It seems like you are calling sum on 2D arrays, so each output would be a row vector, which you can't store within Output(i). Yo...

alrededor de 4 años hace | 0

| aceptada

Respondida
Y axis in scientific form
How does this work for you? ax = axes; plot(ax, 1:10, (1:10).^10) % get rid of 'x 10^N' in corner ax.YAxis.Exponent = 0; ...

alrededor de 4 años hace | 0

| aceptada

Respondida
how to skip the index of array
Alternatively, idx = [1,2,1,2,4]; N = 6; % max index out = repmat(1:N, numel(idx), 1)'; out = reshape(out(out ~= idx), [],...

alrededor de 4 años hace | 0

| aceptada

Respondida
Matrix dimensions must agree
A is a 4x9 array, so A' is a 9x4 array. A.*A' This tries to use element-wise multiplication on A and A', but they aren't the s...

alrededor de 4 años hace | 0

Respondida
How do I fix my legend?
You can still use the same idea as Ruger28's comment, just pull the pertinent values from mutualInfoTotal: baseNames = {'T9C11'...

alrededor de 4 años hace | 0

| aceptada

Respondida
How to find the time of event?
For this sample matrix: >> matrix = [cumsum(10*rand(25,1)), rand(25,1) < 0.1] matrix = 2.6774 0 3.9889 ...

alrededor de 4 años hace | 0

| aceptada

Respondida
How to check an array for its content?
It sounds like you want to make sure isnan and isempty do return 0. Also, there is no need to explicitly check if the result of ...

alrededor de 4 años hace | 0

Respondida
Reverse the Colormap of Surf plot
Grab the colormap and flip it upside down: f = figure; surf(peaks(50)) colormap(f, flipud(colormap(f))) colorbar

alrededor de 4 años hace | 2

| aceptada

Respondida
Findpeaks: find the interpolation points for the width with the x axis
After you call findpeaks, you could obtain a handle to the current axes, find the handle(s) to the yellow horizontal line(s) whi...

alrededor de 4 años hace | 0

Respondida
How can i see if the value occurs in an array for the first time?
Try one of these. condition = ~ismember(loadp(i),loadp(1:i-1)); % or condition = find(loadp==loadp(i),1) == i; They should b...

alrededor de 4 años hace | 0

| aceptada

Respondida
How to count the number of "" true "" and ""false"" in matrix
How to show a message "True is 66.7%" fprintf('True is %.1f%%\n', 100*TRUES/numel(a));

alrededor de 4 años hace | 0

Respondida
"1D" scatter plot without x-axis
If you only have one-dimensional data but you want to display it on two axes, you'll have to tell MATLAB where (i.e. if you have...

alrededor de 4 años hace | 0

| aceptada

Respondida
Keyboard Function Not Responding
Add a drawnow before your pause(.01) to flush the graphics queue. Or use a longer pause, but of course that messes with the ani...

alrededor de 4 años hace | 1

| aceptada

Respondida
"Invalid second data argument" error while using "plot" function (Lagrange Interpolation)
You are correct, it is complaining because pointy1 is a function handle. You can obtain the output of pointy1 when evaluated at ...

alrededor de 4 años hace | 1

| aceptada

Respondida
how to plot a vector
Vsw is a scalar, so nothing will show when you plot it. You are overwriting the value of Vsw in each loop of your for loop. Do y...

alrededor de 4 años hace | 1

Respondida
cannot fill table with chars?
x=[1;2;3]; y=[4;5;6]; T=table(x,y); T.words = repmat({''}, 3, 1); % this creates a 3x1 cell array After these lines, T.words...

alrededor de 4 años hace | 1

| aceptada

Respondida
Plot: x axis and y axis values with commas as 1000 separators
You can format the tick labels using the TickLabelFormat property of the axis. For example: ax = axes('YScale','log'); plot(ax...

alrededor de 4 años hace | 1

| aceptada

Respondida
Saving data in a FOR loop
Does this work? n=2:50; b = zeros(numel(n),1); for i = 1:numel(n) a = (t_r>=Tvec(n(i))-dt/2) & (t_r<Tvec(n(i))+dt/2); ...

alrededor de 4 años hace | 0

| aceptada

Cargar más