Respondida
Saving .png images in directory
The counterpart to imread is imwrite, not save. save as you've used it saves all the workspace variable in a mat file (irrespect...

alrededor de 7 años hace | 0

| aceptada

Respondida
choose a number from a matrix based on probability parameter
Either are overly complicated: if rand > 0.8 do_ProcedureA; else do_ProcedureB; end

alrededor de 7 años hace | 0

| aceptada

Respondida
Write metadata to jpg file
Yes, you can embed metada in jpeg files. Typically it's encoded as exif. However, there's no function in matlab to do that. ma...

alrededor de 7 años hace | 1

| aceptada

Respondida
How can i assign a matrix to another matrix with different number of rows and columns
You're asking for the kronecker tensor product, obtained with kron in matlab: >> kron([1 0 0; 0 0 1; 0 1 0], [2 3; 2 2]) ans =...

alrededor de 7 años hace | 0

Respondida
Merging specific Excel files according to a string in the filename
folder = '\\fscbeng\Project\Lab_Measurements\Results\20190424-1'; filelist = dir(fullfile(folder, '*.csv')); filedata = cell...

alrededor de 7 años hace | 0

| aceptada

Respondida
Erosion/Dilation of images with Alpha channel
The image processing toolbox does not have any notion of transparency, so the answer is simple: alpha has no impact on any morph...

alrededor de 7 años hace | 1

Respondida
I'm trying to fill a cell array with different conditions.
It's unclear what form your data is in. If it's in excel use readtable to import it into matlab. demodata = table([1; 1; 1; 2; ...

alrededor de 7 años hace | 0

Respondida
Replace Nan by a number in a cell array
Your question is not very unclear. You show a loop filling (part) of a cell array with ... something unspecified. Presumably, th...

alrededor de 7 años hace | 0

| aceptada

Respondida
append new rows in the middle of an excel file's sheet
Probably the easiest way to find out the code you need to use is to record a macro in excel while you do the insertion and fix t...

alrededor de 7 años hace | 1

| aceptada

Respondida
How to find breakup length?
I assume you know the scale of your image otherwise the whole exercise is a bit pointless... The nozzle orifice is not visible ...

alrededor de 7 años hace | 1

| aceptada

Respondida
'Out of memory' error for element-wise vector product '.*'
Prior to R2016b, matlab worked the way you expected. The shape of the vectors did not matter. In R2016b, mathworks changed the b...

alrededor de 7 años hace | 0

| aceptada

Respondida
Is there a way to record the usage of functions in a matlab program?
Bearing in mind that as Adam says matlab has no concept of a user and also bearing in mind that collecting user names may fall u...

alrededor de 7 años hace | 1

Respondida
Logicals with empty double column vectors
c=find(cellfun(@isempty,a)); a(c,:)=[]; The second line implies that a is 2D. Yet, find as used will return linear indices, so...

alrededor de 7 años hace | 0

| aceptada

Respondida
Can a string be converted into a function call inside a GUI?
"This does not" str2func(fname) Yes, because str2func doesn't invoke the function, it just returns a handle to the function. Y...

alrededor de 7 años hace | 2

Respondida
How to select a random number from a matrix
Use randi to select an index at random: A(randi(numel(A)))

alrededor de 7 años hace | 4

Respondida
sizing microgrid using for and if statement
It sounds like you have several problems. The first one being the data generation which you currently do with some form of digit...

alrededor de 7 años hace | 1

| aceptada

Respondida
how to find all possible path between 2 nodes
Here is the code I posted as a comment to Walter's answer, it requires this function from my answer to another question: %g: a ...

alrededor de 7 años hace | 2

| aceptada

Respondida
Filling missing values of selected columns of a table with previous values
Star's answer works (please don't delete it!) or you can use: Data(:, {'English', 'Science'}) = fillmissing(Data(:, {'English',...

alrededor de 7 años hace | 2

Respondida
Problem with logical indexing
freezing is the name of the function. So when you write freezing inside the function, you're telling it to call itself. Of cours...

alrededor de 7 años hace | 2

| aceptada

Respondida
Check common elements in two vectors and remove them from both the vectors leaving any duplicate. (Example Inside)
"Thank you, intersect did it" intersect on its own will not do it since all set membership functions (setdiff, setxor, union, i...

alrededor de 7 años hace | 0

Respondida
Reading data from csv files
%your original code, slightly modified csvfiles = dir('*.csv'); filescontent = cell(numel(csvfiles), 1); for i = 1:numel(csv...

alrededor de 7 años hace | 0

| aceptada

Respondida
How can i change the values of entire rows or columns using values of other rows or columns in a 3D matrix with for loops;
This works with your example: c = cat(3, [2 0 3 0 1; 0 0 0 0 0; 1 0 3 0 2], [3 0 1 0 2; 0 0 0 0 0; 5 0 3 0 8], [1 0 5 0 9;0 0 0...

alrededor de 7 años hace | 0

Respondida
Calculate minimum distance between points in a mesh
Here is one way: points = rand(20, 2); %demo data distance = hypot(points(:, 1) - points(:, 1).', points(:, 2) - points(:,...

alrededor de 7 años hace | 0

Respondida
How to export a struct to flat file?
fnames = fieldnames(MCI1); c = struct2cell(MCI1)'; heights = cellfun(@numel, c(:, 4)); t = [cell2table(repelem(c(:, [1 2]), h...

alrededor de 7 años hace | 1

| aceptada

Respondida
i need to convert a folder of 200 .jpg images to .mat (to create 200 separate .mat files). i know there should be an easy matlab for loop to do this but I need help (newbie). thanks!
folder = 'C:\somewhere\somefolder'; filelist = dir(fullfile(folder, '*.jpg')); %get list of all jpg files in the folder matna...

alrededor de 7 años hace | 2

Respondida
function variable undefined. How to declare it ? Says Totalcost not defined
What you have written is a script (name unknown) with a local function called Budgetcompare. A function (local or normal) never ...

alrededor de 7 años hace | 0

Respondida
Extract column data based on date
Most likely (for lack of a sample file to test code with): wavedata = readtimetable('C:\somewhere\somefile.csv'); %requires R2...

alrededor de 7 años hace | 0

Respondida
Conversion of multidimensional cell into string
Taking a guess here, since you're still not using matlab syntax for your example: C = {2, [0,1,0]; 73, [0,1,1,1]; ...

alrededor de 7 años hace | 0

Respondida
How to order a matrix?
how can i do that? Use uniquetol instead of unique. Note that the 'rows' option of unique is 'ByRows', true with uniquetol [~,...

alrededor de 7 años hace | 0

Respondida
Correct error in logical indexing
You use length on a matrix. If your matrix happens to only have one row, your code will error since length will return the numbe...

alrededor de 7 años hace | 3

Cargar más