Answered
Can anybody edit this code such that everytime loop runs, line gets printed to the row next to the already printed row in results.csv file?
Open the file using the <https://www.mathworks.com/help/matlab/ref/fopen.html |fopen|> permission |'a'|, and this will *append* ...

9 years ago | 1

| accepted

Answered
how to make piece-wise function with if statement ?
In theory your code would work, after a few tweaks. In particular you need to read the <https://www.mathworks.com/help/matlab/re...

9 years ago | 2

Answered
Import files with identical names from different directories (no error messages)
Just because something was written by someone at a university does not mean that it is well written. That code is pointlessly co...

9 years ago | 1

| accepted

Answered
how to multiply a row of matrix
Simpler: >> a = 4; >> b = 10; >> V = a+~mod(a,2):2:b V = 5 7 9 to multiply all of the elements ...

9 years ago | 1

| accepted

Answered
ismember: how to read the results quicker?
find(ismember(...)) Keep in mind that logical indexing is more efficient for simple indexing tasks, so the answer to the ...

9 years ago | 0

| accepted

Answered
Best function for opening up .csv files as a matrix?
Use <https://www.mathworks.com/help/matlab/ref/csvread.html |csvread|>

9 years ago | 0

Answered
how do I create many excel file
How to read multiple files is explained extensively in the documentation, on this forum, and in the wiki: <https://www.mathwo...

9 years ago | 1

| accepted

Answered
code relates to matrices
<https://www.mathworks.com/help/matlab/ref/hankel.html> You should be able to figure it out from the example in the |hankel| ...

9 years ago | 1

| accepted

Answered
Cell to Number Array
str2double(a)

9 years ago | 17

Answered
How can I make matlab use the function from the latest built m-file
clear foo <https://www.mathworks.com/matlabcentral/answers/224876-executing-code-that-s-dynamically-written-to-a-file> <...

9 years ago | 0

| accepted

Answered
error " Assignment has fewer non singleton rhs dimensions than non singleton subscripts"
Use <https://www.mathworks.com/help/matlab/ref/sub2ind.html |sub2ind|>: M(sub2ind(size(M),idx,idy)) = 1 @Elkhanssaa Mars...

9 years ago | 0

| accepted

Answered
solve non-homogeneous matrix multiplication
Use <https://www.mathworks.com/help/matlab/ref/mldivide.html |mldivide|>: >> A = [1 2 3;4 5 6;7 8 9]; >> B = [10;11;12] ...

9 years ago | 0

Answered
How to determine if cell contains only numbers
It really depends on what you define a "number" to be: * negative? * complex? * exponent notation? * hexadecimal? * Inf o...

9 years ago | 2

| accepted

Answered
complete a matrix by means of another matrix
Use <https://www.mathworks.com/help/matlab/ref/interp1.html |interp1|> and linear interpolation, e.g.: >> FR = [0.1,0.3,0.5...

9 years ago | 0

| accepted

Answered
Incorrect use of the function zeros().
As the error message clearly states, the inputs to |zeros| must be integer values (e.g. 0, 1, 2, ...). With your code you are su...

9 years ago | 1

| accepted

Answered
What's the difference between vectors and arrays?
Just the size. All arrays, matrices, vectors, and scalars in MATLAB are actually ND-arrays with infinite trailing singleton d...

9 years ago | 5

Answered
I used function dir to list folder contents. I alse need to extract folder's name. But, the result was struct without folder field. How can I get folder's name?
Never rely on the _online_ help for finding out what your _installed_ version of MATLAB can do. The online help is _useful_ and ...

9 years ago | 0

| accepted

Answered
How can I turn off the visibility of a specific face in a patch?
Visibility, like all other properties, applies to the entire <https://www.mathworks.com/help/matlab/ref/patch-properties.html pa...

9 years ago | 0

Answered
How to get the number of output arguments for a MATLAB expression?
_"So in order to generalize, is there any possible way to know in advance that the expression is going to send one or two output...

9 years ago | 0

| accepted

Answered
function in for loop
You need to output something from your function, most likely your want |R| and |R1|, e.g. function [R,R1] = CentreCircle(M,...

9 years ago | 1

| accepted

Answered
How can I parametrize a cosine to become asymmetric?
This is one simple solution, where a |p| value of 1 returns |cos|, and other |p| values change the shape: fun = @(x,p)2*(((...

9 years ago | 1

| accepted

Answered
Why this function is wrong written
F = 3*((1-x).^2).*exp(-x.^2-(y+1).^2); ^ you need this . Read about the difference here: <https://www...

9 years ago | 0

| accepted

Answered
How to seperate a String at different positions?
You could use <https://www.mathworks.com/help/matlab/ref/mat2cell.html |mat2cell|> to split the string into strings in a cell ar...

9 years ago | 2

| accepted

Answered
Declare contents of string variable as an explicit type without formatting them
Simply prefix all hexadecimal strings with |0x| and then |sscanf| will detect this and make the appropriate conversion: ...

9 years ago | 1

Answered
convert base to base
Download John D'Errico's excellent FEX submission |base2base|: <https://www.mathworks.com/matlabcentral/fileexchange/58850-ba...

9 years ago | 0

| accepted

Answered
Matlab Concatenation Question Help
Well, you have taken my original code and made some changes to it: some of the changes are okay, and some are not (e.g the |deal...

9 years ago | 0

Answered
I have 2 "if" conditions and i need to apply it to multiple rows of data.
Do not waste your time learning inefficient and ugly code that relies on loops and |if|-s. These are not required, not matter ho...

9 years ago | 2

Answered
Read all files from a folder, edit them and save.
How to read multiple files is explained extensively in the documentation, on this forum, and in the wiki: <https://www.mathwo...

9 years ago | 1

Answered
how can I delete some rows from 2-D array?
Where |M| is your matrix: newmat = M(M(:,1)~=0,:)

9 years ago | 2

| accepted

Load more