Answered
Allocating segmented images to own variables into loops
If the intent is split an image into blocks then using loops is very overkill. A single call to <https://uk.mathworks.com/help/m...

8 years ago | 1

Answered
code execution take time
Loops may be slow or fast in matlab or in C. It all depends on whether or not the code has been written efficiently. An ineffici...

8 years ago | 0

Answered
I have two 1x128 matrices. I want to substract them, but only for specific columns (For examples for columns 1 to 50 and 90 to 128.
data3 = data1; data3(:, [1:50, 90:128]) = data1(:, [1:50, 90:128]) - data2(:, [1:50, 90:128]); or the other way round: ...

8 years ago | 0

Answered
How do I replace a line in a file and rewrite the file?
Your code goes wrong on the first line: fh = fopen(winners,'w+'); As <https://www.mathworks.com/help/matlab/ref/fopen.ht...

8 years ago | 0

Answered
Mass replace text, then split the replaced text into multiple columns - from multiple csv files
*Solution for when heroes are just separated by a space:* In its own m file: function varargout = split_heros(heroes, va...

8 years ago | 0

| accepted

Answered
What is wrong with line 13?
I can see at least two things wrong with the code you've posted. * |ea| and |iter| are not defined before you try to use them...

8 years ago | 0

Answered
I get a different mean in matlab that i got from Excel for the same input
If matlab and excel wrote a 1000 digits after the decimal point and the 999th digit differed would you still worry about the dif...

8 years ago | 0

Answered
Write data to text file containing \s in string?
Change your two |fprintf| to just this one line: fprintf(textfil2, '%s\n', tline);

8 years ago | 0

| accepted

Answered
Regex Replace cannot lock on to correct character offset in replacement
I don't understand why you have two consecutive replacements. This will give you the correct result: regexprep(myStr, '(...

8 years ago | 0

Answered
Saving results from loop with intervals
As Stephen and I said, splitting your table into multiple tables is probably going to complicate things for you. I would recomme...

8 years ago | 2

Answered
Is there any possibilities to multiply Hue and Saturation of each & every pixel(values must average at last) in an image?
mean2(prod(HSI(:, :, [1 2]), 3)) or mean2(HSI(:, :, 1) .* HSI(:, :, 2)) or HS = HSI(:, :, 1) .* HSI(:, :, 2)...

8 years ago | 0

| accepted

Answered
grouping data based on the times a value is repeated
m = [1 45 67; 1 23 89; 1 90 110; 2 41 52; 2 51 76; 2 77 88; 2 13 14; 3 545 111; 3 242 53; 3 80 23; 4 11 22...

8 years ago | 0

| accepted

Answered
Matching and adding data from multiple columns between different arrays
[isinB, where] = ismember(A, B(:, 1:3), 'rows'); assert(all(isinB), 'some rows of A are not in B'); A = [A, B(where, 4:end)...

8 years ago | 0

| accepted

Answered
How to fix error in Calling MATLAB Functions from C++?
It looks like the matlab engine requires access to matlab dlls under _matlabroot\extern\bin\win64_ As badly explained under t...

8 years ago | 1

| accepted

Answered
Hiding workspace values in Pcode
Write a function instead of a script. It's better design anyway and functions execute faster than scripts. More importantly, the...

8 years ago | 1

Answered
Extracting a row of data from multiple files and loop into a calculation.
Presumably all the files have the same number of rows. Otherwise, you need to specify what to do with the extra rows in some of ...

8 years ago | 0

Answered
Creating tool license function
Well, yes |disp| only displays the message then proceeds with the next line. |error| aborts the code: if now > datenum('2018...

8 years ago | 0

| accepted

Answered
how can i interpolate a 2d matrix in to a 3d array?
You *never* need eval. It's as simple as that. The cases where you'd have to use eval are very rare and unless you're doing some...

8 years ago | 2

| accepted

Answered
subscript assignment dimension mismatch solutions
Since matrices can't have empty elements you can't store your iteration results into a 3D matrix. Yo u could use a cell of 2D ma...

8 years ago | 0

Answered
how to write this summation?
I don't think your equation is right. The way to implement that summation properly would be: [ii, jj] = ndgrid(1:m); hh = ...

8 years ago | 3

Answered
how to calculate the similarity between row vector and column vector using Euclidean distance
If you get this error, that would be because you're using a version of matlab older than R2016b. For versions that do not have t...

8 years ago | 0

Answered
from Excel Time Import and Use in Arithmetically in Matlab
Save yourself a lot of trouble if you are using an mildly recent version of matlab (R2014b or later) and use <https://www.mathwo...

8 years ago | 0

| accepted

Answered
defining a function in script file
b = @(t) 8.89e-5*t^3 - 4.57e-3*t^2 + 2.27e-1*t - 9.52e-3; area = @(y) (1.6e-3*y^4 - 2.76e-2*y^3+ 1.4e-1*y^2 - 1.1e-1*y + 0....

8 years ago | 0

| accepted

Answered
How to get score of each combination of pairs in each tool
Very easily done if your data is in a <https://www.mathworks.com/help/matlab/tables.html table>, using <https://www.mathworks.co...

8 years ago | 1

| accepted

Answered
How to solve "Attempted to access index 2 of an array with smaller dimension sizes....The valid index range is 1 to 1."
I don't know anything about matlab coder but if the problem is that it's not happy with your array growing inside the loop, then...

8 years ago | 0

| accepted

Answered
How to get text that is dynamic on a graph?
In general figures do not update while code is running. To force an update while code is running use <https://www.mathworks.com/...

8 years ago | 1

| accepted

Answered
Listen for Changes to Property Values
If I understood correctly, wouldn't the following be the simplest way to implement what you want: classdef (ConstructOnLoa...

8 years ago | 0

| accepted

Answered
How a binary image can be divided into four equal parts using loop ?
I'm not sure why or even how you'd use a loop. [height, width, ncols] = size(yourimage); splitimages = mat2cell(yourimag...

8 years ago | 3

Answered
All possible combinations of 0's and 1's
a = [1, 0, 0, 1] sets = {0, [0 1]}; combsets = sets(a + 1); [combsets{:}] = ndgrid(combsets{:}); combsets = resh...

8 years ago | 0

Answered
Importing data: recognizing if a variable is present
If you use |readtable| to import your csv files, matlab will automatically recognise that there is a header and use the names in...

8 years ago | 0

Load more