Answered
Getting an array from another function
That function is really not well written. Here is a better version with all the useless operations removed: function timest...

9 years ago | 1

Answered
Indexing into a cell array to retrieve specific value
You would probably be better off using a <https://uk.mathworks.com/help/matlab/tables.html table> instead of a cell array. In...

9 years ago | 0

| accepted

Answered
Comparing datetime value from two tables
A |datetime| always has an hour, minute, second component. The display format of the |datetime| array may be such that it is not...

9 years ago | 0

| accepted

Answered
I have calculated fractional value of each image in an image array ,but how to calculate average of all the fractional values of an image array using matlab.
I don't know what _fractional value of an image_ mean. To calculate the average of an array: mean(yourarray(:)) or if yo...

9 years ago | 0

Answered
How do I link a library (.dll and/or .lib) to my mex code?
_The static library unzips into 22 dynamic libraries_ _The main dynamic library can be unzipped_ Huh? Neither static libra...

9 years ago | 1

Answered
How can I fix my code so that it evaluates matrices of all sizes?
Read the documentation of <https://www.mathworks.com/help/matlab/ref/length.html |length|>, understand that it's not a very usef...

9 years ago | 0

Answered
Using timetable column values in loop control?
A loop is not needed and it is probably much simpler not to use a loop: daypartband = [0, 7.5, 16, 19, 21, 24; ... hours a...

9 years ago | 1

Answered
How do I delete an entire row from Excel from MATLAB?
It's not hard to do in matlab if you know excel VBA. If you don't, it's just as easy to record a macro in excel and use that rat...

9 years ago | 1

| accepted

Answered
How do I convert each data value in a column matrix to log10 values
Is this a trick question? Something you're not telling us? to calculate the log10 of a matrix, you use the <https://uk.mathworks...

9 years ago | 0

| accepted

Answered
Ignoring [NaN; NaN]
if all(isnan(A)) A = B; elseif all(isnan(B)) B = A; end %proceed with A and B

9 years ago | 1

| accepted

Answered
Creating an interesting matrix
It's not clear in your example where a = 4 has any influence on the output. Perhaps your matrix is supposed to go all the way up...

9 years ago | 0

Answered
How mat2gray work in matlab and How can I scale image using mat2gray as the format, 0 for max value and 255 for min value?
You can look at the code of |mat2gray| and understand how it works by typing edit mat2gray at the command line. You'll f...

9 years ago | 1

Answered
fread: how to read n bytes from bin files
_Is it correct?_ The easiest way for you to find out is to try. fid = fopen('acc-angle.bin', 'rb') There's no |'b'| optio...

9 years ago | 2

| accepted

Answered
I have no idea what I am doing! Please Help! the question is below.
_MATLAB just says 'Unexpected MATLAB expression.' whenever I run the code_ Read the documentation of <https://uk.mathworks.co...

9 years ago | 0

Answered
Fprintf: how to automatically move to a new line when reach end of screen?
It's not possible. You would need access to information about the width of the command window, something matlab does not provide...

9 years ago | 2

Answered
How to compare some specific entries of a matrix, if I have their indices stored in 2 files?
As per José-Luis' answer, you have to use |sub2ind| to convert your 2D indexing from A and B into linear indices. This would wor...

9 years ago | 0

Answered
Looping and average through column values of a CSV
Probably the easiest is to import your data into a table with <https://www.mathworks.com/help/matlab/ref/readtable.html |readtab...

9 years ago | 1

| accepted

Answered
How to assign a matrix instead of scalar in another matrix at specified locations with or without kronecker product?
There may be something in <https://uk.mathworks.com/help/matlab/ref/gallery.html |gallery|>, otherwise this would work: ele...

9 years ago | 0

| accepted

Answered
command to read all current pressed keyboard keys
From base matlab itself, it's not possible. There may be something in the <http://psychtoolbox.org/ psych toolbox>. Otherwise...

9 years ago | 7

Answered
how to insert an asterisks on some elements of a matrix that meet condition?
Matrices in matlab store numbers and numbers only. |2*| is not a number and therefore cannot be stored in a matrix. The only ...

9 years ago | 0

Answered
Abbreviate acces to struct fields
With structures, no it's not possible. Matlab does not support _pointers/reference_ to variables. The workaround is to define a ...

9 years ago | 1

| accepted

Answered
how to set a line with different color
No, it is not possible to have a single line object with segments of different colour. You have to have a new line object for ea...

9 years ago | 0

| accepted

Answered
To put score value based on neighbor column position value in same row
One way: toinsert = num2cell(repmat(-(0:size(funct, 1)-1)', 1, size(funct, 2)/2)); toinsert(cellfun(@isempty, funct(:, 1...

9 years ago | 1

Answered
Larger size matrix comparison faster elementwise
Still not entirely sure what you call _similar_, particularly with matrices of different size. If you want the number of element...

9 years ago | 1

Answered
Larger size matrix comparison faster elementwise
Elementwise comparison has never needed a loop: A == B is all that is needed. And if you want the values at the position...

9 years ago | 1

Answered
How to populate a cell array with vector elements?
Assuming you want to append the elements of your vector to vectors in the corresponding cells of your cell array: result = ...

9 years ago | 0

Answered
how to remove the first and second element from cell?
b = cellfun(@(v) v(3:end), a, 'UniformOutput', false);

9 years ago | 0

| accepted

Answered
Generate matrices with non-zero submatrices
n = 10; %for example A = arrayfun(@(k) blkdiag(zeros(k-1), ones(2), zeros(n-k)), 1:n, 'UniformOutput', false); celldisp(...

9 years ago | 1

| accepted

Answered
How to define a column vector whose elements are column vector?
You have to use a cell array: d = {[1;2;3]; [4;5;6]; [7;8;9]}; d{1} %to get the first vector

9 years ago | 1

Answered
from cell to date
datetime(yourcellarray, 'InputFormat', 'dd/MM/yyyy HH')

9 years ago | 2

| accepted

Load more