Answered
If I select an element in a matrix, say MAT(2,2), how to find how many elements of the same value of MAT(2,2) in the matrix are "connected" to it.
You need bwconncomp <https://it.mathworks.com/help/images/ref/bwconncomp.html> For example: Mat=[1 2 3 4 2;2 2 2 2 0;...

ongeveer 8 jaar ago | 2

Answered
how to change or compliment a particular bit in the binary string?
Here it is a=50; b=dec2bin(a) pos = 4; b(pos) = char(97-double(b(pos)))

ongeveer 8 jaar ago | 1

Answered
string to number conversion with mixed values
str1 = 'index_N=10' str2 = 'index_M=5' sub1 = str1(7:end) sub2 = str(7:end)

ongeveer 8 jaar ago | 0

Answered
How do i adjust the spacing between the slices of my stacked images?
First, most probably you don't want to stack them in the 4-th dimension as you wrote rgb4D = cat(4, IA, IB, IC, ID); Bec...

ongeveer 8 jaar ago | 0

Answered
3D grouped bar graph
I think the only way is to group data into one matrix (bar2 groups data row-wise) figure(1) bar3([y1,y2],'grouped')

ongeveer 8 jaar ago | 0

Answered
Randomly scramble letters in a single word
No need of while. If you want to permute word letters with forced use of a loop, extract one-by-one the letters from word withou...

ongeveer 8 jaar ago | 1

Answered
How to find unique elements in a vector without using unique or find?
Use an histogram based approach (works only for positive integers) %get M random numbers from 1 to N M=10; N=25; ...

ongeveer 8 jaar ago | 0

| accepted

Answered
How to mirror matrix on the diagonal?
In the case described before it is: A=[1 2 3;4 5 6;7 8 9] rot90(A,2)' which gives: A= 1 2 3 4 5 6 ...

ongeveer 8 jaar ago | 4

Answered
Can waitforbuttonpress function be used with switch cases..?
Output of waitfrobuttonpress is not a string, is number: for i=1:10 keydown = waitforbuttonpress; switch k...

ongeveer 8 jaar ago | 1

| accepted

Answered
How to load a .dat file?
<https://it.mathworks.com/matlabcentral/answers/79885-reading-dat-files-into-matlab>

ongeveer 8 jaar ago | 0

Answered
How can I write both number and text to a file?
Look here: <https://it.mathworks.com/help/matlab/ref/fprintf.html> Here it is: x = 'BEGIN 0.00 0,0 0.5,1 1,1.5 1.5,1....

ongeveer 8 jaar ago | 0

Answered
Find entire rows in a matrix where a column value meets a certain condition
Assume your 50000x4 matrix is A, this will remove all the rows such having 4th element = 101300: A(A(:,4)~=101300,:)=[];

ongeveer 8 jaar ago | 0

Answered
How to I overlap two images?
Here it is img = zeros(256,256); img(:, [1:6:end, 2:6:end, 3:6:end]) = 1; imshow(img), axis on; %build RGB image...

ongeveer 8 jaar ago | 1

| accepted

Answered
Creating a matrix with binomial distribution in elements.
Check for "binornd" function in Matlab docs

ongeveer 8 jaar ago | 0

Answered
Convert 3D matrix to 2D matrix.
I try to guess from your question: %random 3D array A=rand(5,6,7); %extract a 2D matrix from first dimension of A ...

ongeveer 8 jaar ago | 0

| accepted

Answered
Sort 3d matrix according to another 3d matrix
According to Walter's comment, the previous solution was wrong. Here is a way to sort B given the sorted A along the 3-rd dimens...

ongeveer 8 jaar ago | 0

| accepted

Answered
Exporting Figures in matlab
I don't think export_fig allows you to set height and width. But, consider using -m<val> - option where val indicates the ...

ongeveer 8 jaar ago | 0

Answered
Can someone explain why I'm getting 0 as answer for the following integral?
This is a case where quadrature formulas fail.. Indeed, by computing the (very simple) integral manually, one gets integ_...

ongeveer 8 jaar ago | 0

Answered
Error when running certain function
Type the command ver in the command line, and check in the list if Financial Toolbox is there. If not, you need to inst...

ongeveer 8 jaar ago | 0

Answered
Graphs Not Showing Up
You just see the last two ('3' and '4') because the values are the same, so curve are superimposed and you just see the last one...

ongeveer 8 jaar ago | 0

Answered
How to reshape an matrix made from an input turned into a double value?
Your code only works for 4-characters long strings because you are reshaping them to 2x2 matrix.

ongeveer 8 jaar ago | 0

Answered
How to plot the relationship between two unknown values as those values change?
For every Y~=T, the equation above is true for X=WZ/(Y-T)...

ongeveer 8 jaar ago | 0

| accepted

Answered
random data generation using mean and identity matrix
Just transpose the solution: MU=zeros(1,10); SIGMA=eye(10); xTrain = mvnrnd(MU,SIGMA,1000)';

ongeveer 8 jaar ago | 0

| accepted

Answered
Compute a new vector dependent on two others and a random probability
By doing x==0.2 | y==0.2 you are testing that ALL theelements of x or y equal 0.2. Is that really what you want?

ongeveer 8 jaar ago | 0

Answered
What is the logic behind fzero and fsolve which make fsolve's speed faster than fzero?
The functions fsolve and fzero are not meant to solve the same problem. Specifically: # fzero: It finds the root of a functio...

ongeveer 8 jaar ago | 6

| accepted

Answered
questions about solving a linear equations ( \ vs pinv vs least-square)
Your matrix X has full rank, so the difference between the two methods shouldn't be so high. Running it on my pc I indeed obtain...

ongeveer 8 jaar ago | 0

Answered
How to plot semilog y graphic in Matlab?
The matlab function semilogy() is what you need: <https://it.mathworks.com/help/matlab/ref/semilogy.html?searchHighlight=semi...

ongeveer 8 jaar ago | 2

| accepted

Answered
sort X and Y columns according to a repeated string in a 3rd column and scatter plot
Get the "subject" column in one array containing data of all people, as follows: allsubjects = data(:).subject

ongeveer 8 jaar ago | 0

Answered
[V,D]=eig(S1,S2) ?
They are not captured by the syntax of eig(A,B). Let me explain you why: The call [V,D] = eig(A,B) returns diagonal ...

ongeveer 8 jaar ago | 0

Answered
a matlab code of getting a value uniformly at random from a the set {-1,1}
If you look for a real number in the interval [-1,1], here is it n = 2*rand-1 If you look for an integer either 1 or -1,...

ongeveer 8 jaar ago | 2

Load more