Answered
change the number of digits for complex number after zero decimal points
I'm assuming you just want text for the purposes of displaying it. If what you're asking for is 5 significant figures, then tha...

5 years ago | 2

| accepted

Answered
Move elements of a vector to the rigth.
Try this: a=[1 2 3 4 5] b=circshift(a,[0 1])

5 years ago | 0

| accepted

Answered
MATLAB matrix strange operation
Conceptually, I would have no idea what S is, since I don't know what I or favg are with essentially zero context. As far as th...

5 years ago | 0

Answered
I can't plot square or rectangle correctly
Right off the bat, the xlim and ylim were way off in the weeds (at least for the parameters i chose). Try these changes: % use...

5 years ago | 1

| accepted

Answered
getting this error- "Array indices must be positive integers or logical values"
Do you mean to be multiplying these as factors? I can only guess. x = 1:101; a = 0.1088667334; Aj= -2.669*10^-4; Bj= 0.73409...

5 years ago | 0

Answered
I need to find standard deviation from labeled matrix
If what you're trying to do is get the standard deviation of the regions specified by the label matrix, try this. clear variabl...

5 years ago | 0

| accepted

Answered
Can anyone explain what this means. "Warning: Matrix is ​​singular to working precision. "
For the future, post code using the formatting tools available to you. Do not post pictures of code. Nobody can run a picture ...

5 years ago | 1

| accepted

Answered
How to change the color of a stacked bar?
There are probably various ways to solve this. If the colors are adequate and you merely want to change their ordering, conside...

5 years ago | 1

| accepted

Answered
how to load a matrix into the workspace and save the value of a cell into a float variable
A .mat file may contain multiple objects. Nobody can guess what's in your .mat file. For the sake of demonstration, I'll ass...

5 years ago | 0

| accepted

Answered
Converting an n x m matrix into a single array
How about something like this? source = [8202, 8202, 8202, 8201, 8202, 8202, 8202, 8208]; sbin=de2bi(source,'left-msb'); % p...

5 years ago | 0

| accepted

Answered
locate element using find function in 3D matrix
I am not really sure what the end goal here is, but to just get the row/column indexes of the subset of values selected t = inp...

5 years ago | 0

| accepted

Answered
solving trigonometric equation on matlab
There are probably symbolic ways to approach this, but let's just say you want numeric solutions like what you're doing here. A...

5 years ago | 0

Answered
How to repeat first column and join to another column?
Here's one approach: % given a row vector a=[1 2 3 4 22 23 24 43 44 45 64 65]; B=[repmat(a(1),[length(a)-1 1]) a(2:end)']

5 years ago | 1

Answered
extracting character from a string
If you only want the n-th character, then it's simple: mystring='MATLABQUESTION'; fifthchar=mystring(5) which would be: fift...

5 years ago | 0

| accepted

Answered
Problem with getting results for plotting (X,Y)
The index t increments through the integers 0 to 30. While it's true that t is always an integer, it is not a positive integer....

5 years ago | 0

| accepted

Answered
Help explain a portion of a code
This appears to be a naive 5-element Laplacian high-pass filter of sorts. You're basically convolving the original image with a...

5 years ago | 1

| accepted

Answered
How can I call a function every three time steps?
Something like this: for tt=1:20 if ~mod(tt,3) % do special stuff in this case disp('tt is a multiple of 3') end ...

5 years ago | 1

| accepted

Answered
How to count average Hue of all pixels except the black one?
Your problem statement is ambiguous; "just the colorful pixels" isn't the same as "non-black pixels". You'll have to decide wha...

5 years ago | 1

| accepted

Answered
Why is the outcome like this (matrix manipulation)?
You have the array A: A=[ 1 2 3 4; ... 5 6 7 8; ... 9 10 11 12; ... 13 14 15 16] When you do this: A(3:4...

5 years ago | 2

| accepted

Answered
how to loop until the difference in the percentage becomes zero?
Considering I have no idea what you're actually calculating, a basic approach would be something like this: % define some error...

5 years ago | 0

Answered
Index exceeds problem in line 19
It means exactly what it says. You've defined Cn as a 1x8 vector, then you are trying to reference its i-th element, where i is...

5 years ago | 0

Answered
Saving Answers as Matrix
You just want to concatenate the arrays? I'm guessing the outputs are Duration and area. You can do that like this: % concatena...

5 years ago | 0

Answered
Inserting new element after each element of an array
You should be able to loop through the array regardless of its size. That said, you don't need to. A=[1 2 3 4]; B=dec2bin(A);...

5 years ago | 0

Answered
how to plot f(x,y) = x^2/y, y>0
Perhaps an example will suffice. % plot 2-x^2+y^2 for x=[-1,1], y=[-1,1] x=linspace(-1,1,10); y=linspace(-1,1,10); [X Y]=mes...

5 years ago | 0

Answered
My script is working wrong with nested for loops
I'm not sure what you were trying to nest here. Would something like this suffice? a = input('enter a number:') clf figure...

5 years ago | 0

| accepted

Answered
Compose Large Matrix of smaller matrices
I'm just going to work with a smaller example array: % generate a dummy array % each cell contains a 2x2 array of integers fro...

5 years ago | 1

Answered
MATLAB code to stop the program running when it meets conditions
If you want everything to stop, use return; if you're in a loop and you just want to break out of the loop, break;

5 years ago | 0

| accepted

Answered
How to extract the first four and last four digits of all numbers of an array where each number is of 12 digits?
Try this % this is my example data num=[152012073637; ... 325081863583; ... 841721647389; ... 648968298758; ...

5 years ago | 2

| accepted

Answered
Repeat While loop with the final result (Matlab)
For the future, please post code in a formatted code block. Don't post pictures of code. Nobody can run a picture of code. Th...

5 years ago | 0

Answered
why do I get the error "Not enough input arguments."
I'm not sure what all this code is doing, but the file Get_Functions_details.m, you have the local function objective(): functi...

5 years ago | 0

Load more