Answered
fprintf into a stored variable
Add M = zeros( 0, 2 ); before the loop and replace fprintf('%d)\t%f\tf(x)=%f\n',i,xe,f(xe)); by M( e...

10 years ago | 0

| accepted

Solved


Return the largest number that is adjacent to a zero
This example comes from Steve Eddins' blog: <http://blogs.mathworks.com/steve/2009/05/27/learning-lessons-from-a-one-liner/ Lear...

10 years ago

Answered
Please help me with the code....
A start >> str = sprintf( '%c ', 'matlabiseasy' ) str = m a t l a b i s e a s y >> str2 = permute( reshape( str...

10 years ago | 0

Answered
How to convert a GUI to an .exe application?
See <http://se.mathworks.com/products/compiler/ MATLAB Compiler, Build standalone applications from MATLAB programs>

10 years ago | 0

| accepted

Answered
Replacing string by start of this string
Hint: %% cac = {'AMD','INTEL','ZILOG' 'ZILOG','AMD','INTEL' }; %% cac = regexprep( cac, '^Z.+$', 'Z80' )...

10 years ago | 0

| accepted

Answered
implementation of subclass from triangulation
You are too kind to Matlab. Matlab shall not crash whether or not you make a mistake. Now I crashed R2013b a couple of time with...

10 years ago | 0

Answered
We call this as Script or function
A script operates in the workspace of the caller, e.g. the base workspace. It may use existing variables and may create new var...

10 years ago | 1

Answered
Attempt to execute SCRIPT surfnorm as a function:
Most likely there is another file named *|surfnorm|* that shadows the proper file. Run which surfnorm -all to find out

10 years ago | 0

| accepted

Answered
How do I make assignments to my workspace using variable names and values in a spreadsheet?
AFAIK: one cannot do it without *|"eval"|*. Yes, there are good reasons to avoid *|eval|*. However, in your situation it mig...

10 years ago | 0

| accepted

Answered
Extracting multiple datasets from a text file
_"the following format"_ &nbsp Your description is incomplete. Thus, I need to make a number of assumptions: # the entire fil...

10 years ago | 0

Answered
reading a text file by correct date format
It's a challenge to read files like yours with Matlab. >> clear >> [c1,sdn,c3,c4] = cssm( '010802_Q_1997.txt' ); >...

10 years ago | 0

Answered
how can i change the path when saving the file ?
Replace wavwrite(y,filename) by wavwrite( y, fullfile( pathname, filename) )

10 years ago | 0

| accepted

Answered
Sorting a cell array of strings on dim
2015-12-18: Fixed a "typo". With R2013a. Loop over all rows and concatenate %% cac = arrayfun( @(jj) sort(x(jj,:)), ...

10 years ago | 1

Answered
How can I get the first 10 characters of each cell in an array?
This is more readable >> tic, sdn = cellfun( @(str) datenum( str(1:10), 'yyyy-mm-dd' ), t, 'uni',true ); toc Elapsed ti...

10 years ago | 2

| accepted

Answered
how to convert a string to a vector
One way >> str ='1,3,3,4,5,6,6' str = 1,3,3,4,5,6,6 >> num = textscan( str, '%f', 'Delimiter',',' ) num = ...

10 years ago | 1

Answered
Converting unformatted text to formatted text
I have assumed that the size of the resulting arrays are known %% fid = fopen( 'c:\m\cssm\test4.txt' ); rows = textsc...

10 years ago | 0

| accepted

Answered
Reading data from a specific CSV file
This code is based on your description of the problem, rather than your code. I choose to store the data in a structure, rat...

10 years ago | 0

| accepted

Answered
How can I input every file in a directory ending with .txt into my Matlab program while logged in through ssh?
_"every single file ending with .txt in a directory,"_ &nbsp Try sad = permute( dir( fullfile( folderspec, '*.txt' ) ),...

10 years ago | 0

| accepted

Answered
finding most common letter in a cell array
Try %% x = {'overcomplete';'phellandrene';'phenanthrene';'pneumatocele';'pneumonocele' 'preintercede';'preinte...

10 years ago | 0

Answered
How can store the values of this forever-while loop?
Try clear all;clc; N=1; SI= exp(-1.*N); tol = 10.^(-1.*10); y = zeros(1,0); while true SI= exp(-1.*N)...

10 years ago | 0

Answered
Get multiple variables in an input
Run %% cac = inputdlg( 'Enter your next move ( row,col;row,col;...)' ); num = str2num( cac{:} ) and input: &nbsp...

10 years ago | 0

Answered
adding letters to string
Assuming _"input"_ means that a user inputs letters interactively %% str = ''; buf = {''}; while not( isempty( buf...

10 years ago | 0

Answered
removing elements of cell array of strings
One without an explicit loop %% random_letter = 'r'; word_list = {'aam','aani','aardvark','aardwolf','aaron','aaronic...

10 years ago | 1

| accepted

Answered
anonymous function which outputs a vector of sums when the input is a vector of indices.
Try >> f = @(X,ix1,ix2) arrayfun( @(ix) sum(X(ix1:ix)), ix2 ); >> f([1:7],4,[5:6]) ans = 9 15 >> f([1:7...

10 years ago | 1

| accepted

Answered
Read file and find maximum value
The file, *|11a-LEP.txt|*, contains multiple blocks. The blocks in turn consists of a header and two columns of numerical data. ...

10 years ago | 0

Answered
how read a date-time from HDF5 file
How to extract date and time from a string? (In this case the string happens to be the name of a HDF5-file.) First something...

10 years ago | 0

| accepted

Answered
how to generalize a nested for-loop?
Try >> tic, for ii = 1:5000, h1 = cssm( 4 ); end, toc Elapsed time is 0.279794 seconds. >> tic, for ii = 1:5000, h1 ...

10 years ago | 0

| accepted

Answered
How to call subclass constructor
_"I just want cr to be "part of" M"_ &nbsp I don't understand what you try to say. I read it as " *|M|* has a *|cr|*", but your ...

10 years ago | 0

| accepted

Solved


Which values occur exactly three times?
Return a list of all values (sorted smallest to largest) that appear exactly three times in the input vector x. So if x = [1 2...

10 years ago

Solved


Back to basics 14 - Keywords
Covering some basic topics I haven't seen elsewhere on Cody. Return a cell array of all MATLAB keywords

10 years ago

Load more