Answered
Monte Carlo simulation examples
<https://www.mathworks.com/discovery/monte-carlo-simulation.html>

5 years ago | 0

| accepted

Answered
??? Attempted to access c(15); index out of bounds because numel(c)=14.
The expression on line 5 of HEM.m references the 15th and 16th elements of c (written as "c(15)" and "c(16)", respectively). The...

5 years ago | 0

Answered
How to generate random (2 integer number) pair from the given values (say integer from 1-10) without repeating the integer number?
If I understand correctly that there should be no repeated values anywhere in any pair, you can do this: N = 10; reshape(randp...

5 years ago | 0

| accepted

Answered
newline
You would have to put a newline() character in there, e.g., fprintf(fid,'\n'); The file pointer will then point to the next byte...

5 years ago | 0

Answered
how to perform .reshape([-1,1]) multiplication in MATLAB as in python
You can do reshape(B,1,[]) to make a row vector and reshape(A,[],1) to make a column vector.

5 years ago | 0

| accepted

Answered
Scanning a CSV file
You could use readmatrix(), csvread(), xlsread(), textscan(), fread(), etc.

5 years ago | 0

Answered
Extracting data values from function/figure
You can use fopen() to open a text file for writing, fprintf() to write your data to the file with the format you want, and fclo...

5 years ago | 0

Answered
Plotting a line on same axes as pcolor in GUI
hold(handles.pAxes,'on');

5 years ago | 0

Answered
Write in an edit text character set: A-Z, a-z and '-'
You are replacing any character in '-+eEgG' with a space, but the space character is not in the valid character list.

5 years ago | 0

Answered
load in for loop
for r=0:999 aa = sprintf('%d',r); load(['n' aa '.mat'], 'AAA') ; end

5 years ago | 0

Answered
Load Data in For loop
for r=0:999 aa = sprintf('%d',r); load(['n' aa '.mat'], 'AAA') ; end

5 years ago | 0

Answered
Load Data in For loop
for r=0:999 aa = sprintf('%d',r); load(['N' aa '.mat'], 'AAA') ; % ... end

5 years ago | 0

Answered
how many times matrix elements are repeated
A = [1 0 2; 1 1 2] nnz(A == 1) nnz(A == 2)

5 years ago | 0

Answered
Question on how to multiply various elements of structures
part = [struct('x',1) struct('x',2)] [part.x].*2

5 years ago | 0

Answered
loop repeating itselt
Check that your 'end' keywords all correspond to the keyword they're supposed to (i.e. 'if', 'for'). It looks like you may have ...

5 years ago | 0

Answered
how plot these data?
Calling plot() with a matrix plots one line per _column_ of the matrix. Since each _row_ of your matrix represents the data for ...

5 years ago | 0

Answered
How to represent the string value of a variable
car = struct('mass',1000); choice = 'mass'; car.(choice)

5 years ago | 0

Answered
How to properly align output text in command window?
One solution is to use enough characters in your fixed-width format, so that the strings that get fprintf'ed are exactly the sam...

5 years ago | 0

Answered
Nested GUI functions to get information
You are exactly right about the reason this happens. The function that creates the 'child' GUI (selectMultiplyNumber) executes a...

5 years ago | 0

Answered
GUIDE user input to plot data
You can call evalin() in your GUI callback to access variables in the base workspace: function pushbutton26_Callback(hObject, e...

5 years ago | 0

Answered
How do I convert Binary format (.bin) to ASCII format (.asc) files?
backslash ('\') is an escape character in sprintf format strings, so if you want to use a string with backslashes in it in sprin...

5 years ago | 0

Answered
How do I retrieve the numbers contained in my table?
'7,373.34' is a character array, and when you do numerical operations on it, the individual characters are treated as numbers ac...

5 years ago | 0

Answered
binary mask
A = magic(5) mask = logical(1-eye(5)) A(~mask) = NaN

5 years ago | 0

Answered
Check for missing argument or incorrect argument data type in call to function 'integral'.
syms x theta f = sqrt(2)*x^3; a = int(f, 0, 9) g = 4+2*(sin(theta)^2); b = int(g, 0, pi/2) ans = a*b

5 years ago | 1

| accepted

Answered
How to lookup and return a corresponding value from table?
It isn't working because cmnt1(i,1) is a sub-table of the table cmnt1 that contains one cell of cmnt1. You want to refer to the ...

5 years ago | 0

| accepted

Answered
Interpolating 2D position data
I would not do the interpolation this way. Instead, I would find x(t) and y(t), i.e., interpolate both x and y in terms of some ...

5 years ago | 0

Answered
How to plot array graph based on the equation?
If you want to plot u vs r, with one line for each time, you can do plot(u); or, if you want to plot u vs time, with one line ...

5 years ago | 0

Answered
Pass curvefit start points into function
You can add an additional input argument to your createFit function: function [fitresult gof] = createFit(z,y,startPoint) % use...

5 years ago | 0

| accepted

Answered
Audio Chirp From Point Backwards
If you have the signal processing toolbox, you can use chirp.

5 years ago | 0

Answered
we assume that vectors X(k)are independent and identically distributed (i.i.d.).what's does it mean?
https://en.wikipedia.org/wiki/Independent_and_identically_distributed_random_variables

5 years ago | 0

| accepted

Load more