Answered
IMWRITE writing all black pictures?
Not many format support |uint16| images. The only ones available to |imwrite| are JPEG, PNG and TIFF. Support for reading and di...

10 years ago | 0

Answered
How to create “Date” containers in Matlab, ignoring months and years?
Learn to manipulate |datetime| objects: Either use the <https://www.mathworks.com/help/matlab/ref/day.html |day|> member func...

10 years ago | 0

| accepted

Answered
It is posible to write a script with many functions and call these functions?
As of R2016b, you can have <https://www.mathworks.com/help/matlab/matlab_prog/local-functions-in-scripts.html local functions> i...

10 years ago | 1

| accepted

Answered
How can I get a Class Object of C++, which is created in Mex function, after running the Mex?
Assuming both dlls are compiled with the *exact* same options with the same compiler, you could just pass the |CBodyBasics*| poi...

10 years ago | 0

| accepted

Answered
Change how matlab stores image data for C++
No, you cannot change the order of the colour channels in matlab (don't know about OpenCV). However, if you don't display the im...

10 years ago | 0

| accepted

Answered
parse error at clear : usage might be invalid MATLAB syntax
As of R2016b you can have <https://www.mathworks.com/help/matlab/matlab_prog/local-functions-in-scripts.html local functions in ...

10 years ago | 0

Answered
create live script R2015a
Live scripts were introduced in R2016a, you will need to upgrade before you can use them.

10 years ago | 0

| accepted

Answered
Merge text and numeric formats to double
If |B| is really declared as B={12.4949 6.96103 NaN 7.03814 13.0399... 12.5195 7.02181 NaN 7.39418 12.7675... 1...

10 years ago | 0

| accepted

Answered
Creating a hex array with 4 digit blocks from an array of integers
DecArray = [1 2 4 69876]'; h = arrayfun(@dec2hex, DecArray, 'UniformOutput', false); cellfun(@(s) strcat('0x', cellstr(r...

10 years ago | 1

Answered
How to sum points in an 2-D area efficiently?
Your intermediate field |myobj| that does not appear to serve any purpose slightly complicates things. I would avoid multilevel ...

10 years ago | 0

| accepted

Answered
how can i sum over to variable in matlab?
Without any a priori knowledge of |F|, |G|, |K|, this is guaranteed to work: [NN1, NN2] = ndgrid(0:19, 1:20); %all combina...

10 years ago | 0

Answered
How can I extract a string bewteen one character and a string from a text?
|.*| is a dangerous expression in regular expression since it eats everything (particularly in matlab which is the only language...

10 years ago | 0

Answered
Would changing my operating system from OSX to Windows allow Matlab to run xlsread for my Mac or do I need to convert all Excel files to .cvs?
|xlsread| works on Mac but only in basic mode, which should read most excel files as long as you don't want to restrict it to a ...

10 years ago | 0

Answered
minimum of 4 integers
Put all your integers in one array and call |min|, e.g.: min([10 15 11 9])

10 years ago | 0

Answered
Concatenate arrays in foor loop. Torque problem
If I understood correctly, this would achieve what you want a lot simpler: L = [3 6 2 5]; npl = 1000; %I'm assuming ...

10 years ago | 2

Answered
Is it ok to have rounding errors when rounding to integers?
In my opinion it's a bug that you should report to Mathworks. It's ironical that round produces a less rounded number than y...

10 years ago | 0

Answered
how to reduce the information contained in each field in a struct array?
Function to filter a scalar structure: function s = filterstruct(s) rowstocheck = ~cellfun(@isempty, regexp(s.B, '\[a...

10 years ago | 0

| accepted

Answered
MATLAB won't let me change the value of a string
There are 2 (3 since R2016b) different ways to store strings in matlab, each with their pros and cons. * A 2D char array as y...

10 years ago | 0

Answered
How to check the sort order of a vector
Please, do read Stephen's comment to your question above and follow his excellent advice. The simple way to implement what I ...

10 years ago | 2

| accepted

Answered
Get binary Mask of selected regions
Assuming a grayscale image: mask = ismember(yourimage, [91 92 111 118 147]); %obviously adjust the values of the vector to...

10 years ago | 1

| accepted

Answered
Index exceeds matrix dimensions error
I would recommend breaking that expression into smaller parts, using temporary variables. I certainly can't keep track of the op...

10 years ago | 0

Answered
Error using ./ Matrix Dimensions Must Agree ??!! how to solve this??
Clearly, one of the image is a grayscale image and the other is RGB. And clearly, you're not using R2016b since your division...

10 years ago | 0

| accepted

Answered
How to extract data from data file?
Rather than the outdated and less powerful |xlsread| you can use <https://www.mathworks.com/help/matlab/ref/readtable.html |read...

10 years ago | 0

| accepted

Answered
How to keep adding a number to a matrix if it occurs several times
This would work: matrix_original=[7,7,4;12,10,10;-3,7,2;10,12,12;10,12,12;10,7,4]; for col = 1:size(matrix_original, 2) ...

10 years ago | 1

Answered
How to sum matrices of each cell along the 3rd dimension?
One option: newval = {sum(cat(3, val{:, 1, :}), 3), sum(cat(3, val{:, 2, :}), 3)} A generic version of the above for arb...

10 years ago | 0

Answered
indexing a matrix with another matrix
B(sub2ind(size(B), A(:, 1), A(:, 2))) = 255;

10 years ago | 0

Answered
How to assign rgb values to multiple row,col of a matrix ?
If the R, G and B values are identical: image(sub2ind(size(image), repmat(rows, 1, 3), repmat(cols, 1, 3), repmat([1 2 3], ...

10 years ago | 0

Answered
how to concatenate mat files of different row sizes but same column size vertically?
Please use the *{} Code* button to format your code as code. I'm unclear from your question whether it's the number of rows o...

10 years ago | 0

Answered
Vertically concatenate a 2 column comma separated list
|[a, b]| is the same as <https://www.mathworks.com/help/matlab/ref/horzcat.html |horzcat|>, |[a; b]| is the same as <https://www...

10 years ago | 2

| accepted

Answered
replacing NaN with dot in a table
Why would you want to do that? While it is possible to do it, it's going to make using that table much harder. Matlab knows what...

10 years ago | 1

Load more