Answered
Highlighting individual Cells in UITable
See also: https://www.mathworks.com/matlabcentral/answers/25038-how-to-change-each-cell-color-in-a-uitable I did not see a solu...

7 years ago | 2

| accepted

Answered
Script that calculates the following sum
n=0 S=0 % Now S is a scalar while S > 1.990 % In the first iteration you compare a scalar % Bu...

7 years ago | 0

Answered
Extracting first n values of a matrix
A guess: v = randi([1,50], 1, 1000); for k = 10:20 m = find(v == k); if numel(m) < 30 error('Too few elemen...

7 years ago | 0

| accepted

Answered
how Matlab figure quality maintain ?
I export my diagrams as EPS files using print. On the screen the poor TIFF preview is displayed in MS Word, but for print outs t...

7 years ago | 0

Answered
How to Edit Drop Down Item field based on a changing variable in App Designer
This is not clear, because it is no valid Matlab code: if c = 'hay';'bye' (2x3 char array) Do you mean: c = ['hay', 'bye']? ...

7 years ago | 0

| accepted

Answered
Find the maximum value in each group of a big matrix
data = randn(10,1)*10; edges = [-Inf, 0:5:35, Inf]; Y = discretize(data, edges); Result = accumarray(Y, data, [], @ma...

7 years ago | 2

| accepted

Answered
Solving ODE with Matlab
t = 0:dt:t_final; for i = 1:length(t) % if t<=0.5s tau=tau_0 else tau=0 if t(i) <= 0.5 tau = tau_0; els...

7 years ago | 1

| accepted

Answered
Error using horzcat Dimensions of matrices being concatenated are not consistent.
Use the debugger to solve such problems. Type in the command window: dbstop if error Start the code again, and when the proble...

7 years ago | 1

| accepted

Answered
Interpolate a 4D matrix to increase its size
[X,Y,Z] = size(B); B1 = interp3(1:X, 1:Y, 1:Z, B, ... linspace(1, X, 250), ... linsp...

7 years ago | 0

| accepted

Answered
help with this problem
The error message is clear: See doc assignin to see, that it requires 3 arguments: data = load(fullfile(path,file)) assign...

7 years ago | 0

| accepted

Answered
Finding all occurences of a string within a cell array (itself part of a struc)
match = strcmp('Tori', dataDens.raga) % Logical indexing index = find(match) % Linear indexing If you wa...

7 years ago | 0

| accepted

Answered
How can i use nchoosek to output both the k combinations and the remaining combinations?
% The loop version: m = 10; n = 4; v = nchoosek(1:m, n); nv = size(v, 1); w = zeros(nv, m - n); for k = 1:nv t ...

7 years ago | 0

Answered
Replace value-by-value WITHOUT a loop, from 2 vectors?
X = [1,2,3,4;5,6,7,8;1,4,2,1;6,7,1,2]; a = [1,2,3,4]; b = [100,200,500,400]; [M, ia] = ismember(X, a); X(M) = b(ia(M))

7 years ago | 1

| accepted

Answered
REPEATING COMMAND BY FUNCTION
You should not use GOTO in any code, because it is massively unclear. Use a loop instead: while true p1='Please enter Mini...

7 years ago | 0

| accepted

Answered
I am trying to plot the temperature over time
tVector = 0:time_step:t_final for it = 1:numel(tVector) heat_loss = convection_coefficient*time_step*(T_bottle-T_working);...

7 years ago | 0

Answered
how to set the axes component size to be fixed without to be resize with image size?
It depends on what "width=200" mean. The units matter: Are these data units or pixels? Ax = axes('XLim', [1, 200], 'YLim', [1, ...

7 years ago | 0

Answered
Access to struct atrribute for changing names
Using names like "newMPsOfRun6010_03" shows, that important information is stored in the name of a variable. This is a bad progr...

7 years ago | 1

| accepted

Answered
How can I read a huge json file (0.5GB)
If you use fileread, the 0.5 GB of bytes are converted to a char vector, which occupies 1 GB of RAM, because Matlab uses 2 Byte ...

7 years ago | 0

Answered
Saving data into corresponding arrays of a cell array in cycles
What exactly is the problem? A = cell(N, 3); % Pre-allocate!!! for i=1:N if (a condition) if (Condition 1) ...

7 years ago | 1

| accepted

Answered
Is there a way to use the RMS function with two options, namely 'omitnan' and an option for the dimension?
There is no documented 'omitnan' argument for rms in current Matlab versions, see: https://www.mathworks.com/help/signal/ref/rms...

7 years ago | 1

| accepted

Answered
String comparison in cell arrays
filt_data = {'PID';'data';'new';'world'}; dat = {'1';'2';'3';'4'}; ma = {'PID';'new';'world'}; match = ismemb...

7 years ago | 0

| accepted

Answered
legend text is transparent in MATLAB R2018a
This has been discussed here already: https://www.mathworks.com/matlabcentral/answers/353013-in-2017a-how-do-i-prevent-a-legend-...

7 years ago | 0

| accepted

Answered
How to select a time from one array which is close to the time in another array ?
Prefer to use modern datetime objects instead of cellstrings containing datestr values: A = [{'05:10:34'} {'05:42:52'} {'06:52:...

7 years ago | 0

| accepted

Answered
How do I pause Matlab execution to wait for file edits
It is a bad idea to edit M-files during the execution. It would be much better to edit a file, which contains the modified param...

7 years ago | 0

Answered
How can I keep just the arrays with 2 is before 3 after random swap 2 numbers.
s = [1,2,3,4,5]; s = s(randperm(numel(s))); % Random permutation? % Or swap 2 elements: index = randperm(numel(s), 2)...

7 years ago | 0

| accepted

Answered
Can you help me to correct this error?
while isempty(A)==0 will not work, because the matrix A does not change its size. I guess you mean: while any(A(:) ~= 0) % Or ...

7 years ago | 0

Answered
How can I loop over a binary image to get 4 equal quadrants always?
Using 4 distinct variables is less convenient than reshaping the array: s = size(q1); q2 = reshape(q1, s(1)/2, 2, s(2)/2, 2);...

7 years ago | 0

Answered
error using imwrite command
The error message is clear: Either the file is existing already and you cannot overwrite it (maybe it is open in another program...

7 years ago | 0

| accepted

Answered
multiply all numbers above a threshold in a matrix by n, but only on certain indices, and keep original matrix dimension
index = (matrix(:, 115) > 0.5); % logical mask matrix(index, 115) = matrix(index, 115) * 100;

7 years ago | 0

| accepted

Answered
please help with this If else statement
Similar to your C++ code, just with some shorter names for variables to reduce the chance for typos: function main toefl1 = in...

7 years ago | 1

| accepted

Load more