Answered
generate increasing exponential series for 10 numbers with sum equal 1.
v = rand(1, 10); v = sort(v) / sum(v) would be one way to generate a <https://en.wikipedia.org/wiki/Monotonic_function m...

8 years ago | 0

| accepted

Answered
How to display indexed images from .mat file using colormap?
Having looked at the code for your |displayData|, it is not possible to use it with indexed images with different colour maps wi...

8 years ago | 0

Answered
Why can't I assign this matrix to a variable while also reassigning a value?
Even if matlab allowed chaining assignments, what you have written would be very ambiguous. You have to seperate the operations ...

8 years ago | 1

| accepted

Answered
How increase the value of each cell from 256*256 to 576*720
If the intent is to calculate the sum of the diagonals of the matrix (corresponding upper and lower diagonals being sum together...

8 years ago | 0

Answered
Store sets of values as indices in a matrix?
I'm assuming that |hix| and |vix| are functions, and I'm assuming that for each pair of vector input, they each return a vector ...

8 years ago | 0

| accepted

Answered
Efficient way to use regexp and contains and matching
Right now, your double loops can be simplified to: validVar = {}; for x = 1:numel(list) if ~isempty(cell2mat(regex...

8 years ago | 0

| accepted

Answered
"Row-wise" reshape of 3d matrix -> 2d matrix
You simply need a different permutation of the dimensions: reshape(permute(M, [3 1 2]), [], size(M, 2))

8 years ago | 3

| accepted

Answered
How to line graph from different excel sheet once for all sheet ?
xlfile = 'NNDTV.xlsx'; [~, sheets] = xlsfinfo(xlfile); %get list of sheets in workbook X = (1:20)'; %as a column vect...

8 years ago | 0

| accepted

Answered
Replacing an image in excel
First, avoids relying on |ActiveAnything|, it's a recipe for bugs. For example, with your code something (e.g. the user) could a...

8 years ago | 0

| accepted

Answered
At which cell sizes does it make sense to preallocate memory
From a speed perspective, it all depends on what is going on in your loop. If it takes you an hour to generate a row of the matr...

8 years ago | 2

| accepted

Answered
Extend / replicate a value by column when found in array
This is trivially achieved with |cumprod| since as soon as a 0 is encountered in a column the cumulative product is 0 from then ...

8 years ago | 0

| accepted

Answered
How to generate a random number of n bits length?
_For n = 4 it should generate a number in the range [8-15]_ If I understand correctly, you want a 4 bit random number with th...

8 years ago | 1

| accepted

Answered
index exceed matrix dimension
Most likely, your |files| cell array is empty, hence the 1 |files{1}| exceeds the size of the array (0 = empty). What is ...

8 years ago | 0

Answered
i have to do bitxor on image pixel wise
From your latest comment, I'm unclear whether or not you've solved your problem. The code you've posted will always error when p...

8 years ago | 1

Answered
Re-write repeated values of a matrix using intermediate increased values
Another option is to use <https://www.mathworks.com/help/matlab/ref/fillmissing.html |fillmissing|> with the |'linear'| option (...

8 years ago | 1

| accepted

Answered
Undefined variable "matlab" or class when opening MATLAB figure
It doesn't look like your |openfig.m| is the R2014a version. Strings were introduced in R2016b and in my version (R2018a), |conv...

8 years ago | 2

Answered
To find maximum value of any matrix without using built-in max()
Forget about the code for now. What you've written is fundamentally wrong at the algorithmic level for many reasons. You need to...

8 years ago | 1

Answered
Row-by-row analysis after establishing a threshold value
Another way to obtain the same: A = [0.55 0.45 0.55;0.65 0.75 0.85;0.35 0.95 0.45;0.85 0.15 0.25;0.35 0.25 0.15;0.45 0.45 0...

8 years ago | 0

| accepted

Answered
How come when i generated this command x=[-2:0.1:3] although the value does show but why on top there is (e.g columns 46 through 51 is there anyway to remove it?)
No, this is the way matlab displays vector/matrices on the command line and there is no option to change that. More importantly,...

8 years ago | 0

Answered
Calculating all paths from a given node in a digraph
I've not tested it thoroughly but I think this should work: function paths = getpaths(g) %return all paths from a DA...

8 years ago | 4

| accepted

Answered
Run exe with an input file and close upon process exit
As I said in my comment, |cfd.exe < inputfile.in| *does not pass any input argument to the executable*. It's a completely differ...

8 years ago | 2

| accepted

Answered
Categorical cell array reshaping
_this is a 2x7 cell array of 1x1 categorical arrays_ example cell array: yourcellarray = num2cell(categorical([1 0 0 0 0...

8 years ago | 0

| accepted

Answered
Empty array of class objects from string name of class
_"Those familiar with Matlab will know that this will not work"_ This.elements(end+1) = obj; Indeed, but the semanticall...

8 years ago | 1

Answered
Extract time of stimulation using bwlabel function
[startrow, whichcolumn] = find(diff([zeros(1, size(m, 2)); m]) > 0) If it's absolutely guaranteed that there will be the sa...

8 years ago | 0

Answered
Hi guys, Matlab novice here : "Index in position 1 exceeds array bounds must not exceed 10" from the code below. I think it is fairly obvious, but I don't see it. Your help would be much appreciated
Without knowing the size of any of the variables and without you telling us *which line* causes the error, it's difficult to tel...

8 years ago | 0

| accepted

Answered
How to merge a cell 2x60 into 1x60?
One possible way: newcellarray = cellfun(@(column) cell2mat(column), num2cell(yourcellarray, 1), 'UniformOutput', false);

8 years ago | 0

| accepted

Answered
isa not recognizing Line or Figure class
>> x=-2*pi:.01:2*pi;HLine=plot(sin(2*x)); >> class(HLine) ans = 'matlab.graphics.chart.primitive.Line' >> is...

8 years ago | 1

| accepted

Answered
How do I import a text file and average data in a column from said file?
filecontent = fileread('AHMOD.txt'); usefulcontent = regexp(filecontent, '([^ ]+) +\$[^,]+,([^,])+,(.*)$', 'tokens', 'linea...

8 years ago | 0

| accepted

Answered
How to modify a large textfile according to words in another textfile in MATLAB?
It could be as trivial as: indexword = readtable(textfile1, 'ReadVariableNames', false); indexword.Properties.VariableNa...

8 years ago | 0

| accepted

Load more