Respondida
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...

casi 8 años hace | 0

| aceptada

Respondida
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...

casi 8 años hace | 0

Respondida
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 ...

casi 8 años hace | 1

| aceptada

Respondida
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...

casi 8 años hace | 0

Respondida
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 ...

casi 8 años hace | 0

| aceptada

Respondida
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...

casi 8 años hace | 0

| aceptada

Respondida
"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))

casi 8 años hace | 3

| aceptada

Respondida
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...

casi 8 años hace | 0

| aceptada

Respondida
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...

casi 8 años hace | 0

| aceptada

Respondida
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...

casi 8 años hace | 2

| aceptada

Respondida
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 ...

casi 8 años hace | 0

| aceptada

Respondida
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...

casi 8 años hace | 1

| aceptada

Respondida
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 ...

casi 8 años hace | 0

Respondida
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...

casi 8 años hace | 1

Respondida
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 (...

casi 8 años hace | 1

| aceptada

Respondida
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...

casi 8 años hace | 2

Respondida
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...

casi 8 años hace | 1

Respondida
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...

casi 8 años hace | 0

| aceptada

Respondida
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,...

casi 8 años hace | 0

Respondida
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...

casi 8 años hace | 4

| aceptada

Respondida
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...

casi 8 años hace | 2

| aceptada

Respondida
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...

casi 8 años hace | 0

| aceptada

Respondida
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...

casi 8 años hace | 1

Respondida
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...

casi 8 años hace | 0

Respondida
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...

casi 8 años hace | 0

| aceptada

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

casi 8 años hace | 0

| aceptada

Respondida
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...

casi 8 años hace | 1

| aceptada

Respondida
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...

casi 8 años hace | 0

| aceptada

Respondida
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...

casi 8 años hace | 0

| aceptada

Cargar más