Answered
Using index of 3d array from max option to access elements from another 3d array
I always find it difficult to think in 3D, but the following should do what you want. In any case, <https://www.mathworks.com/he...

9 years ago | 1

| accepted

Answered
Call a function in an m-file from a method of a handle class
A method operating on objects of a class *must* have the object as its first input in matlab. (In other languages, e.g C++, this...

9 years ago | 0

| accepted

Answered
executions is fine for the first run but it is showing an error
Well, clearly from the error message, you're passing a 2D matrix to |rgb2gray|. If you pass a 2D matrix to |rgb2gray| it must be...

9 years ago | 0

Answered
Writing to file with condition
I would just construct the matrix to be printed according to your rule, then write it in one go to file. If I understood correct...

9 years ago | 0

| accepted

Answered
Searching in cell arrays.
I'm not entirely sure of the output you want. Maybe: function rows = findrow(matrix, value) %find the rows of matrix ...

9 years ago | 0

| accepted

Answered
increment high resolution distance data by lower resolution equal steps
Wouldn't round(yourvector / desiredstep) * desiredstep %or round((yourvector - yourvector(1)) / desiredstep) * desire...

9 years ago | 0

Answered
OOP: Array object
In matlab everything is an array, even classes you design yourself. If you come from other languages such as Java or C++ this i...

9 years ago | 0

Answered
Need a Matlab code to divide the image of any pixel (M x N) in an Non-Overlapping blocks.
If it's for processing and you don't need the blocks afterward, use <https://www.mathworks.com/help/images/ref/blockproc.html |b...

9 years ago | 0

Answered
Find local maxima of a matrix and the neighboring elements
* _Include the surrounding elements_: <https://www.mathworks.com/help/images/ref/imdilate.html |imdilate|> your regionalmax bina...

9 years ago | 0

| accepted

Answered
Extract some data from a structure and create a new structure.
This should work: senidx = strcmp(data.Sen, 'U1'); mydata = structfun(@(fv) fv(senidx), data, 'UniformOutput', false);

9 years ago | 1

| accepted

Answered
Syntax for MATLAB Excel add-in
I don't have matlab compiler but after a quick reading of the doc it doesn't look like it can generate the kind of add-in that y...

9 years ago | 0

Answered
How to use mat2cell in splitapply?
Is splitapply(@(m) {m}, mat, G) what you're after? You could do the same with |mat2cell| if you really wanted, it's ...

9 years ago | 0

| accepted

Answered
Property validation in subclass
Note: I would recommeng giving a name other than |set| to your property. That name is already overloaded enough by matlab. Y...

9 years ago | 3

| accepted

Answered
Logo looks different after uploading
PNG images can have transparency information embedded in them and yours does. However, you discard it with your |imshow| call. ...

9 years ago | 0

| accepted

Answered
How do I select max columns values based on certain column values?
Not really clear on your question. If you're wanting to calculate the mean of the variables, grouped by seg_ID, then: varfu...

9 years ago | 1

| accepted

Answered
Deleting rows of an array
if you want to delete columns with *all* 0: yourmatrix(:, all(yourmatrix == 0)) = []; if you want to delte columns with ...

9 years ago | 2

| accepted

Answered
Problem in calculation formula
The problem you have is not that your subscripts are not logical, it is that either they're not positive or they're not integers...

9 years ago | 0

| accepted

Answered
Dont get the required answer..please help
Is A=[2 5 3 1 1 ; 4 2 5 1 1]; B=[1 0 1 1 1; 1 0 1 1 1 ]; A(A == 5 & B) = 6 what you're looking for? _edit,...

9 years ago | 1

Answered
how to make the .m code faster ?
First, a piece of advice, don't hardcode values that matlab can easily calculate. In your code |m| and |n| are the number of ele...

9 years ago | 1

| accepted

Answered
How can I keep points from moving outside of a circle
No idea if it's going to solve your problem as I've not tried to understand your code, but: if a.^2 + b.^2 >= [100,100,100,...

9 years ago | 0

Answered
How do i combine many tables by respective column content?
I don't see how your excel tables relate to your original question. There's no repeated key in any of them. Going back to you...

9 years ago | 2

Answered
I try to write program by using vectors: my inputs are vector..How can I index vectors
Probably the simplest thing is to have your vectors as columns of a matrix: A = [1 2 3;2 3 3;3 6 -1]; B = [5 12 3;2 3 3;...

9 years ago | 0

Answered
how to extract 2d window from a 2d matrix
No loop needed: mat2cell(yourmatrix, [3 3 3], [3 3 3]) or you could just reshape the matrix as 3x3x9 and loop over the p...

9 years ago | 0

| accepted

Answered
Fill intensity grayscale with a colour channel
Converting the grey image to pure blue with the same intensity is actually very easy, just use that image as the blue colour pla...

9 years ago | 0

| accepted

Answered
compound interest using for loop
1) You were asked to use a <https://www.mathworks.com/help/matlab/ref/for.html |for|> loop, not a |while| loop. 2) While you ...

9 years ago | 0

Answered
Error in push button callback
The part of the error you need to focus on is not the _for input arguments of type 'char'_ . It is the _*undefined function 'jus...

9 years ago | 0

Answered
I have three matrices X, Y and Z of order 200x1... and my equation is a*X +b*Y + c ==Z... How can I find the values of a, b and c?
I recommend you read <https://www.mathworks.com/help/matlab/math/systems-of-linear-equations.html this> abc = [X, Y, ones(s...

9 years ago | 1

Answered
Read a text file and write the output in a text file after excluding some rows have values in particular range
The neat but slightly slower way of doing it: t = readtable('inputmat.txt'); ...

9 years ago | 1

| accepted

Answered
Horizontally concatenating two column vectors with a comma
Assuming a newish version of matlab (>= R2016b) char(compose('%0.f, %0.f', data))

9 years ago | 0

Answered
How to save numerical array as file (any format) with different precisions (format) for different columns in the same array?
One simple way to write that matrix as text according to your specifications: x = rand(950, 2) .* [100, 1]; %demo data, re...

9 years ago | 0

| accepted

Load more