Answered
Build a matrix of zeros with the size of the initial matrix according to indices
newM = zeros(size(M)); newM(sub2ind(size(M), repmat((1:size(idx, 1))', 1, size(idx, 2)), idx)) = val

7 years ago | 0

| accepted

Answered
summation of each pair of columns in a matrix
Most likely, given the limited explanation: sum(permute(A, [3 2 1]) + permute(A, [2 3 1]), 3) The following may be slightly mo...

7 years ago | 0

| accepted

Answered
Table: Add only selected collumns
1. Create the full table first, however you were going to create it: name = {'Joe'; 'Elisa'; 'John'}; age = [30; 10; 25]; wei...

7 years ago | 0

| accepted

Answered
CellSelectionCallback-update column name
Well, yes, for what you want to do to work, you need a way to update your UI_Column dialog whenever your CellSelectionCallback i...

7 years ago | 1

| accepted

Answered
How can I fix this error - "Matrix dimensions must agree" "x{end,1}.AppName == aa1{selA,1}.Type"
x{end,1}.AppName and aa1{selA,1}.Type are not the same size and neither of them is scalar in the non-scalar dimension of the ot...

7 years ago | 0

Answered
How can I find a specific value of member in cell array
It's really not clear from your description but it sounds like each cell of the cell array contains a scalar structure. If that'...

7 years ago | 0

Answered
Read mixed numbers in Matlab
I would recommend that you modify whatever is creating these files so that it creates files that don't have such an unusual form...

7 years ago | 0

Answered
Undefined function for input arguments of type 'double' - fit function
Most likely you don't have the curve fitting toolbox installed or you don't have a license for it.

7 years ago | 3

| accepted

Answered
Converting 2 8 bit integers into a 16 bit?
swapbytes on an array of uint8 is never going to swap anything. If you want to change the order of the two bytes, then simply co...

7 years ago | 1

| accepted

Answered
I have large matrix and i want to find the number of consecutive zeros if there is more than 10 disply(hole) and give the index of the start and end of this vector of zeros,
x=[1 0 1 4 8 4 3 5 9 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 0 0 0 0 2 4 4 4 4 0 0 0 0 0 0 0 0 0 3 5 6 3 0 0 0 0 4 4 4 0 0 0 0 5 4 1 0 ...

7 years ago | 2

| accepted

Answered
how to create this matrix?
Assume your formula is and not what you have written: nrows = 5; %number of rows. You haven't specified ncols = 7; %numbe...

7 years ago | 1

Answered
How come that meta.class reports that a long list of methods are defined by a class that has nothing but a single enumeration block?
Yes, it's not very well documented. Most of these methods are simply overloads for enumeration classes. You can see that if you ...

7 years ago | 0

Answered
how to access variables from one function to another function?
The simplest is to store your feature vector in handles. % --- Executes on button press in pushbutton4. function pushbutton4_C...

7 years ago | 1

| accepted

Answered
Data transfer from excel to matlab!
It would be much easier to help you if attached a demo excel file so we can be sure of the actual format you're using to store t...

7 years ago | 0

| accepted

Answered
I need to pick random elements from array until a specific sum is met
Use a while loop: a = readtable('dom.txt'); %use a better variable name than a. One that has meaning. summen = NaN; %initial...

7 years ago | 1

| accepted

Answered
Create a zero matrix and update cells based on other column values
I would do it like this: First create a function to create a matrix, given column vectors of ids, ans, and steps for a single s...

7 years ago | 0

| accepted

Answered
Matlab not squaring imaginary part of complex number.
"The complex number is being squared and should result in a real answer with no complex part at all" Huh? Certainly not. . You'...

7 years ago | 1

| accepted

Answered
Creating an image of first non-zero values in a 3d matrix
One way: inverted_image = ~im_datacube; max(cumsum(inverted_image, 3) .* cumprod(inverted_image, 3), [], 3)

7 years ago | 0

Answered
Why does builtin subrefs-method return only the property of one element of an object-array?
The correct syntax should be: [varargout{1:nargout}] = builtin('subsref', obj, S); See Code patterns for subsref and subsasgn

7 years ago | 0

| accepted

Answered
R2019a release notes
Release notes for pre-releases are covered by a non-disclosure agreement. Unless you are invited to test the pre-release you can...

7 years ago | 1

Answered
How do I create two cell arrays in Matlab from two tables(based on date and time) as follows?
Both columns are datetime! That's a very bad idea. Regardless of what is displayed, a datetime always contain both date and time...

7 years ago | 0

| accepted

Answered
Index exceeds array bounds and some other mistakes
When complaining about errors always give us the full text of the error message, everything in red, so we don't have to guess fr...

7 years ago | 1

Answered
How to make a scatter table programmatically?
There's no x value smaller than 0.5 in your inputs so it's unclear why you have a 10 in your first row of your table. I'm going ...

7 years ago | 1

| accepted

Answered
How can I get the mouse position on an image after uploading it on axes
By default Image objects capture mouse clicks. So if an Image is displayed in an axes, when you click on it it's the ButtonDownF...

7 years ago | 1

Answered
How to add element to cell array directly in matfile?
You can't do it directly. You have to load the whole cell array, modify it and write it back as you have done. The documentation...

7 years ago | 0

| accepted

Answered
Set and read matrix from 'setenv'
It sounds like you have a script where all the inputs are hardcoded. First, convert the script into a function with the appropri...

7 years ago | 0

Answered
Vectorization of Operation inside Matrix
First, permute DH so that the rows are in the 3rd dimension as in your output. Then you can vectorise your calculation: DH = pe...

7 years ago | 1

| accepted

Answered
Change the name of structure inside a cell
In your screenshot, mlrModel, fsrModel, etc. are the name of classes. They may look like structures but these things are absolut...

7 years ago | 0

| accepted

Answered
Re-arranging array columns in alternating form
function Y = AlternateColumns(X, n) Y = reshape(permute(reshape(X, size(X, 1), [], n), [1 3 2]), size(X, 1), []); end Bas...

7 years ago | 1

| accepted

Answered
How to import and read Excel input into an executable
readtable will read an excel file and directly transform each column into variables of a table. I would not recommend having ov...

7 years ago | 1

| accepted

Load more