Answered
how to save cell array which not have equal row in each column to .csv
function cell2csv(c,filename) % Writes a cell array of 1D arrays to a csv file c = c(:); fid = fopen(filename...

9 years ago | 0

Answered
How to curve fit a transcendental function to data?
Set k0 = [k1_0;k2_0;k3_0] to a vector of initial values for your unknown parameters. Write your function as: predic...

9 years ago | 1

| accepted

Answered
problem with Matrix Multiplication
Note that in Matlab, vectors are matrices of column or row shape and. A 2 by 2 matrix can only be multiplied by a column vector...

9 years ago | 0

Answered
Problem with fmincon: nonlcon
To transfer the extra inputs to DiagCAW11_constraints you should use an anonymous function: Make sure that RC, r, bsum are de...

9 years ago | 0

Answered
cumsum function for seperate time
Interesting problem. Here is one possible solution: dates = {'01/01/1975'; '05/01/1975'; '25/01/1975'; '05/02/1975';... ...

9 years ago | 0

Answered
How to replace a variable or function with another variable or function ?
You could define an anonymous function f(x): f = @(x) x.*(x.^2-1); Note the '.' before the * and ^operators. This lets t...

10 years ago | 2

Answered
How to reset variables before each iteration
Here is an example that clears all variables except b and c: % Fist create some variables a = 1; b = 2; c = 3; d = 4; ...

10 years ago | 0

Solved


Remove the polynomials that have positive real elements of their roots.
The characteristic equation for a dynamic system is a polynomial whose roots indicate its behavior. If any of the <http://www.ma...

10 years ago

Submitted


read_excel_columns(filename,sheet,columns,firstrow,lastrow)
Read selected columns from a large Excel file using ActiveX

10 years ago | 1 download |

5.0 / 5

Answered
How do I read only specific columns in from an Excel file, not consecutive columns?
I enclose a first version of a function I just wrote. This will read a number of columns from a large Excel file. Since it ope...

10 years ago | 1

| accepted

Solved


Read a column of numbers and interpolate missing data
Given an input cell array of strings s, pick out the second column and turn it into a row vector of data. Missing data will be i...

10 years ago

Answered
How to seperate fractional and decimal part in a real number
mod(number,1)

10 years ago | 0

Answered
What kind of solver should I use for a non-continuous function?
Note that the function that you give to ode45 returns the velocity and acceleration. When you change the sign of v in this func...

10 years ago | 0

| accepted

Answered
Consider a loop of string with unit length. Take n cuts independently and randomly along the string, what is the expected length of the smallest and the largest piece?
Your question is not very clear. The code below is an answer to: How can I code a test of this result? N=100000; % Number ...

10 years ago | 1

Solved


Connect Four Win Checker
<http://en.wikipedia.org/wiki/Connect_Four Connect Four> is a game where you try to get four pieces in a row. For this problem, ...

10 years ago

Solved


Calculate the Levenshtein distance between two strings
This problem description is lifted from <http://en.wikipedia.org/wiki/Levenshtein_distance>. The Levenshtein distance betwee...

10 years ago

Answered
solve a system of ODE
function [t,x]=euleroesplicito(fcn,t0,x0,h,tend) n = fix((tend-t0)/h)+1; t = linspace(t0,t0+(n-1)*h,n); x = ze...

10 years ago | 1

| accepted

Solved


Number of occurrences of letter in a text
Given an input text either as a string or as a cell array of strings, return a (1 x 26) matrix containing the number of occurren...

10 years ago

Solved


Word Counting and Indexing
You are given a list of strings, each being a list of words divided by spaces. Break the strings into words, then return a maste...

10 years ago

Solved


Given two strings, find the maximum overlap
Given two strings s1 and s2, create a new string s3 which is as short as possible and contains both strings. If s1 = [1 2...

10 years ago

Solved


Find the two-word state names
Given a list of states, remove all the states that have two-word names. If s1 = 'Alabama Montana North Carolina Vermont N...

10 years ago

Solved


Find state names that end with the letter A
Given a list of US states, remove all the states that end with the letter A. Example: Input s1 = 'Alabama Montana Nebras...

10 years ago

Solved


Prime factor digits
Consider the following number system. Calculate the prime factorization for each number n, then represent the prime factors in a...

10 years ago

Solved


Remove all the consonants
Remove all the consonants in the given phrase. Example: Input s1 = 'Jack and Jill went up the hill'; Output s2 is 'a ...

10 years ago

Solved


Pascal's Triangle
Given an integer n >= 0, generate the length n+1 row vector representing the n-th row of <http://en.wikipedia.org/wiki/Pascals_t...

10 years ago

Solved


De-dupe
Remove all the redundant elements in a vector, but keep the first occurrence of each value in its original location. So if a =...

10 years ago

Solved


Balanced number
Given a positive integer find whether it is a balanced number. For a balanced number the sum of first half of digits is equal to...

10 years ago

Solved


Find all elements less than 0 or greater than 10 and replace them with NaN
Given an input vector x, find all elements of x less than 0 or greater than 10 and replace them with NaN. Example: Input ...

10 years ago

Solved


Binary numbers
Given a positive, scalar integer n, create a (2^n)-by-n double-precision matrix containing the binary numbers from 0 through 2^n...

10 years ago

Answered
how to speedup the function datetime('('1/1/2014 1:00:00 AM','ConvertFrom','excel')?
[num,txt,raw] = xlsread('file.xlsx') returns date-time values as NaNs in the num output and as strings in the txt and raw ou...

10 years ago | 0

Load more