Community Profile

# Tommy

##### Last seen: Today
286 total contributions since 2017

View details...

Contributions in
View by

How to make a log operation for a matrix excluding the '-inf' values?
k should span from 1 to size(IDHMA,2), similar to ii: for ii = 1: size (IDHMA,1) for kk = 1 : size (IDHMA,2) IDHMAlog (ii,...

environ 11 heures ago | 0

How to make specific elements of a matrix zero before nth element?
Boring: C = A; for i = 1:size(A,2) C(1:B(i)-1,i) = 0; end Ugly: C = A; [N,M] = size(C); C(~any((1:N*M)'>=N*(0:M-1)+B...

1 jour ago | 1

Create new variable with only values of a certain variable
Try this: idx = mutualInfoTotal >= 5; % indices of values at least equal to 5 mutualInfoTotal = mutualInfoTotal(idx);

1 jour ago | 0

| accepted

How to get the data as output along with the histogram plot?
You could request output from histogram(): h = histogram(S,'Normalization','probability'); and access properties such as h.Bin...

1 jour ago | 2

| accepted

Finding pair values in a matrix

2 jours ago | 0

Concatenating 2 vectors into 1 vector with the values adjacent to each other
Should February 2012 map to 20122 rather than 20121? If so, maybe this will do the trick? month = repmat((1:12)', 5, 1); year ...

3 jours ago | 0

Define a plot object but do not show the plot
plot_temperature=plot(day, temperature, 'Visible', 'off'); plot_rainfall=plot(day, rainfall, 'Visible', 'off'); Or if you don'...

4 jours ago | 0

| accepted

Change colour in stem plot, for only particuar values
You could overlay two separate stem plots: data = randi(10,10,1); idx = [4, 9]; ax = axes; hold(ax, 'on'); temp = data;...

4 jours ago | 0

| accepted

How to draw 2 different plot on a graph
hold on or set(gca, 'NextPlot', 'add') in between your calls to plot or however you are plotting.

5 jours ago | 0

MATLAB GUI: How do I pass image matrix into function
In appdesigner, first make sure you are in code view: Then in the code browser on the left side, go to the tab labeled Proper...

5 jours ago | 0

| accepted

How do I change axes font (heatmap)?
Your code is crashing at this line: h.xlabel('FontName', 'Times New Roman'); The x label is set properly because of the previo...

5 jours ago | 1

| accepted

how to debugg the error : size input must be integers
nx = 1.5; % Number of grid points x-direction ny = 0.5; % Number of grid points in the y direction "size input must be integ...

5 jours ago | 0

| accepted

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 ...

5 jours ago | 0

| accepted

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))

5 jours ago | 2

| accepted

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...

5 jours ago | 0

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

5 jours ago | 0

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...

5 jours ago | 1

| accepted

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...

6 jours ago | 1

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);

6 jours ago | 0

| accepted

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...

6 jours ago | 0

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...

6 jours ago | 1

| accepted

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...

6 jours ago | 0

| accepted

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)...

7 jours ago | 1

| accepted

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; ...

7 jours ago | 0

| accepted

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...

7 jours ago | 0

| accepted

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; ...

7 jours ago | 0

| accepted

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), [],...

7 jours ago | 0

| accepted

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...

7 jours ago | 0

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'...

7 jours ago | 0

| accepted