Answered
Why do I get Subscript indices must either be real positive integers or logicals using this code? It appears that the error is in the last two lines. How can I solve this?
There are two big problems here: you did not format your code (by selecting your code and clicking the *{}Code* button), so it i...

8 years ago | 0

Answered
I have spectrometer data (X axis Wavelength, Y axis Intensity), I want to convert this data in to bit string to generate a key in 1s and 0s, is there any tool available in MATLAB to do this?
You should replace |for i = 0:1:3648| by |for i = 1:numel(IR)|. You could also use arrayfun to generate this without a for lo...

8 years ago | 0

Answered
The floating point error exists in both linspace and array creation if the increment is not an integer value. Intersect and ismember fails.
This is probably due to the floating point accuracy. Multiplying so you expect only integers, rounding and then performing this ...

8 years ago | 0

| accepted

Answered
Finding highest position of values in two arrays?
Update: the code below incorporates what you describe and results in the required |C|. A=[0.1 3;0.3 1;0.6 2];B=[0.7 2; 0.8 ...

8 years ago | 0

Answered
Set default value textedit
In your |OpeningFcn|, you need to set a value for the |numseg| field. That way, the field exists in your handles struct and that...

8 years ago | 1

| accepted

Answered
Use only defined 4D array elements
The code below should work for you. Since R2016b you can use the line with implicit expansion. N=3;Z=4;L=6; varcov=resha...

8 years ago | 0

| accepted

Answered
Making STOP - Button
I use a |uicontrol| |togglebutton| in such cases: %in your looping code: if get(handles.togglebutton,'Value') bre...

8 years ago | 2

Answered
Count the appearances of each value per bin within a vector of 144 bins.
So you want to split your original vector into 144 vectors, and then get the |histcounts| of each vector? data=randi([-3 2]...

8 years ago | 1

Answered
Unzipping using system command ? I couldn't understand the command
The |cellfun| function is used to apply a function each element of your cell array. By providing two cell arrays, the function i...

8 years ago | 0

| accepted

Answered
I want to cite Matlab 2017a image processing tool box and computer vision tool box in reserch paper. Please share the bibtex file.
I don't think you need to cite the individual toolboxes. The bibtex below is what I use when citing Matlab. The version can easi...

8 years ago | 0

Answered
I need to store values from a for loop with a non-integer index in matrices. The matrices I have now have random 0's in the output.
You should treat meta-data as data. You can either keep your 'fractional index' as a separate vector (as you have done already),...

8 years ago | 0

| accepted

Answered
How do I find no. of instances of each value till it changes?
You can use the <https://www.mathworks.com/matlabcentral/fileexchange/41813-runlength |runlength|> function that Jan made. An...

8 years ago | 1

Answered
downloading data with webread
You can use <https://www.mathworks.com/help/matlab/ref/gunzip.html |gunzip|>: url = 'http://example.com/example.txt.gz'; ...

8 years ago | 1

| accepted

Answered
App/GUI tutorials
Using GUIDE held me back for a long time, so below you'll find my advice on what to do when not using GUIDE. For distribution, i...

8 years ago | 0

| accepted

Answered
Why can't MEX find a supported compiler in MATLAB R2016a after I upgraded to Xcode 9.4.1?
Because Xcode 9 is not explicitly mentioned in the <https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/support/sy...

8 years ago | 0

| accepted

Answered
How can I pull a 3x3 matrix from a larger one inside a for loop?
I would advise against using |i| as a loop variable, especially if you're using complex numbers. This is the grouping you're ...

8 years ago | 0

Answered
how to open an csv file using xlsread
If you want to read a csv file, there is a function that is designed to do that: <https://www.mathworks.com/help/releases/R2018a...

8 years ago | 1

Answered
sum every 2 pages at a time in 3D matrix
The code below isn't the most efficient for your example, but will work in more complicated situations. data = ones(3,2,5);...

8 years ago | 1

Answered
Help with using SURF to analyze an image?
What your goal is, is not really clear to me, but you can use the code below to view an image as a surf. I used an example image...

8 years ago | 0

| accepted

Answered
Help plotting with simple linespace and surf?
You were very close: you only forgot to change |x| to |X| and |y| to |Y| after you added |meshgrid|. x=linspace(0,2*pi); ...

8 years ago | 2

| accepted

Answered
How can I find the location of the first negative value in a column?
Like this? a=[1;2;-3;4;-5;6]; [r,c]=find(a<0,1); a(r,c) (if you plan on using matrices as well: note that what is ...

8 years ago | 0

| accepted

Answered
How to color cell in a csv file?
A csv file is just a file with text characters. It generally contains numeric values that are separated by commas, hence the nam...

8 years ago | 0

| accepted

Answered
Shift Data to the Right and the Left
Since your vector is a column vector, shifting left or right (e.g. with |circshift|) will result in the exact same vector, while...

8 years ago | 0

| accepted

Answered
Matrix indexing of a 3D matrix, one by one each 3D layer?
Logicals are 8 times smaller than doubles, so memory concerns shouldn't be an issue. If you can work with a big |J|, you can eas...

8 years ago | 0

| accepted

Answered
How can we pass gpuArray in Cdata of imshow?
Because |image| is not holding your hand (and |imshow| is), you need to do the work yourself. In this case that means you need t...

8 years ago | 1

| accepted

Answered
How to group a collection of values in a vector?
There are a myriad of way to do this, one of them should be the code below. data=1:12;%example data data=reshape(data,4,...

8 years ago | 1

| accepted

Answered
WindowButtonDownFcn tries to access a callback function that no longer exists
Apparently the line of code is still there. Either it is saved in a .fig file, or you didn't actually delete/comment the line. ...

8 years ago | 0

| accepted

Answered
open a text file using fopen in read mode
As you can tell from the documentation for <https://www.mathworks.com/help/releases/R2018a/matlab/ref/fopen.html |fopen|>, the o...

8 years ago | 0

Answered
mldivide does not support sparse inputs for code generation
You can try making a copy of this function, and editing it, so you avoid the |sparse| function, as that is causing the problem h...

8 years ago | 1

Answered
When I use the "kmeans" function, I get a message "License Manager Error -4".
Apparently there is a limited number of users for the Statics Toolbox under your license. The only option is to wait until anoth...

8 years ago | 0

Load more