Risposto
Read text file without header and separate columns
You can use the readmatrix function. A = readmatrix(filename,'NumHeaderLines',193); Edit: As Walter suggested below: releases...

circa 6 anni fa | 1

| accettato

Risposto
using the while loop to get the number of divisions
The term you are adding never reaches that low threshold. If it would, the code below would do the trick. You can test it by set...

circa 6 anni fa | 0

Risposto
Error " Array indices must be positive integers or logical values."
You need to distinguish between the index of your variable in Matlab and the subscript in the mathematical sense. sub=___;%...

circa 6 anni fa | 1

| accettato

Risposto
Why when using 'setappdata' in Appdesigner do I have to store it in a figure? Can I store it someplace else?
With the setappdata you are storing data somewhere in RAM, linking it to a graphics object. f=uifigure; setappdata(f,'foo','ba...

circa 6 anni fa | 0

Risposto
Root mean square error of two images
Imagen in Matlab are either 2D or 3D. Assuming your images are already 2D, the subtraction will be element-wise, after which you...

circa 6 anni fa | 1

| accettato

Risposto
Storing error values in for loop
Don't use error as a variable name. Otherwise you can just use indexing: err=zeros(1,N); for n=1:N %your code goes here ...

circa 6 anni fa | 0

Risposto
How to build on an existing struct 4x4xn matrix?
It sounds like you can just assign that value. Matlab will expand the array and fill empty positions with 0. A.G=cat(3,[ 1 2 0 ...

circa 6 anni fa | 0

Risposto
3D Matrix find max values of each position in the first 2 dimensions
It sounds like you need this: data_2D=max(data_3D,[],3); The explanation for this syntax can be found in the documentation.

circa 6 anni fa | 1

| accettato

Risposto
Image extraction from webpage
The HTML file doesn't contain the image. It contains a relative path to the image. Because you don't have the image file in the ...

circa 6 anni fa | 1

| accettato

Risposto
Modifying a function (2D Plot and 3D Plot)
Use linspace separately for x and y and then use meshgrid or ndgrid. %create the vectors x=linspace(xmin,xmax,numx); y=____ ...

circa 6 anni fa | 0

Risposto
Finding repeating values in an array
You can use the outputs of the unique function to achieve this. A = [ 0.3 0.6 1 0.6 0.3]; B = [ 3 2 3 6 11]; [B1,~,ind]=uni...

circa 6 anni fa | 0

Risposto
Block GUI in Callback
This is the way I solved it in my PhotoAnnotation tool: %appdata is the guidata struct (which I now think was a poor choice as ...

circa 6 anni fa | 0

Risposto
How to change a variable in a string
It is much cleaner to use fprintf. That way you can also much more easily insert more numbers to display: function fib(n) % Se...

circa 6 anni fa | 0

Risposto
Multiple if statements with two conditions
Create an array with all implemented values of CA. Then you can use array operations to find the index, which will allow you to ...

circa 6 anni fa | 0

| accettato

Risposto
point decimal to comma
So in summary: Matlab doesn't check the operating system's locale setting to determine the decimal separator. This question seem...

circa 6 anni fa | 0

Risposto
My function is stuck in a loop
That give_index function looks like it is very slow and may return unexpected results for non-integer inputs. It will also only ...

circa 6 anni fa | 0

| accettato

Risposto
How to print the string value using fprintf
The error message explains what is going on: you are trying to use a cell as input to fprintf. fprintf will not 'unpack' that fo...

circa 6 anni fa | 0

| accettato

Risposto
Is it possible for me to get the answer of certain line in a function?
Moved from comment: You can set a breakpoint on that line to pause execution, or you can add the variable as an ouput.

circa 6 anni fa | 0

| accettato

Risposto
am trying to plot P and Q but the matrix dimensions seems to disagree with me.
Somewhere in that humongous anonymous function you have made a mistake. In this case the mistake is that you didn't use array o...

circa 6 anni fa | 0

| accettato

Risposto
Help!! Projectile motion plot
Despite your rudeness (i.e. contiuously flagging my comments) I decided to help you. So below you will find your code with some ...

circa 6 anni fa | 1

Risposto
How do I delete a struct?
If my guesses are correct, the code below should be close to what you need. %replace this if abs(newPred.x - newPrey.x)<v && a...

circa 6 anni fa | 0

| accettato

Risposto
Appropriate imput for dynamic structure field name
Field names in matlab adhere to the same rules as variable names. They can't start with a digit and can only contain 0-9, a-z, A...

circa 6 anni fa | 1

| accettato

Risposto
How to create the upper diagonal block matrix in a specific form.
Here is the code that will generate blocks like [O A O;O O A] given the values of c and g. clear,clc c = 3; g = 1; syms Lamb...

circa 6 anni fa | 0

| accettato

Risposto
THIS CODE WORKS ON 2017b BUT NOT ON 2013b "Error: If FUN is a MATLAB object, it must have an feval method." "Error: fun = fcnchk(fun);" Please Help me, I don't know that where is mistake in code?
This has been an undocumented feature since it started working. The only documented input options are a function name, something...

circa 6 anni fa | 0

Risposto
Find a row in a matrix
Assuming you have that vector already: M=[ 1 -1 1 -1 1 1 1 -1 -1 1 -1 1 % <----- this row 1 1 -1 1]; a=[-...

circa 6 anni fa | 0

| accettato

Risposto
How to find intersection between two line
tol=2*eps; L_intersect = abs(y-y_line.Value) < tol; x(L_intersect) %you could use find(L_intersect), but you don't really nee...

circa 6 anni fa | 0

Risposto
Find Empty Fields in Matrix and Delete them
%generate fake data data=cell(30,10); for n=1:numel(data) if rand>0.2 data{n}=rand(1,5); end end %find ...

circa 6 anni fa | 0

Risposto
How to quickly index the first cell of sets of the array with near similar names?
This is bad code design. You should have made these variables fields of single struct. This has forced you to write slow buggy c...

circa 6 anni fa | 1

Risposto
Tag or label for images in montage
If you don't have the Computer Vision toolbox, you can also use my text2im function to convert text into an image.

circa 6 anni fa | 0

Risposto
while and if statements . Im trying to get my program to stop at a certain count but it only works in some parts. (beginner)
Please make sure you use Matlab syntax. The endwhile keyword is specific to Octave. If you properly allign your code it would be...

circa 6 anni fa | 0

| accettato

Carica altro