Answered
Text box with a variable on one line
Using ; within a { } block will force a new line so try removing those and just concatenating in a [ ] block instead.

12 years ago | 3

Answered
Help with GUI callback - existence condition
isfield( handles, 'num1' ) will tell you if num1 exists as a field in your handles structure. It isn't necessarily the w...

12 years ago | 0

| accepted

Answered
How to find the first local max in a discrete signal?
If you have the signal processing toolbox you can use findpeaks If not then maybe something from the file exchange would...

12 years ago | 0

| accepted

Answered
Converting a matrix of points to a list of x & y coordinates
ind1d = find( myMatrix == 'A' ); [y, x] = ind2sub( [n n], ind1d ); should be close to doing the job, although it dep...

12 years ago | 0

Answered
How to feed a function's output later on?
By the sounds of it some kind of encoding of your x and y values to a single key is what you need. This key can then be used wi...

12 years ago | 0

Answered
Append new column to a cell with zero & one values
pVal = prctile( [A{:,3}], 20 ); A(:,end+1) = {0} A( [A{:,3}] <= pVal, end ) = {1} I think that should do what you...

12 years ago | 1

| accepted

Solved


Select every other element of a vector
Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, s...

12 years ago

Answered
Timetable making MATLAB code
Have you searched the File Exchange? I'm not aware of a mathworks toolbox with ready-made timetabling software, but a search of...

12 years ago | 0

Answered
Find axes callback on which zoom is performed
Can you not just use the axes' ButtonDownFcn callback to trigger your zooming behaviour? Then the axes handle that triggered th...

12 years ago | 0

Answered
Indexing to subtract sections of an array
A = reshape( A, [ 80, numel(A)/80 ] ); A = A(1:64,:); That is going more off your recent comment rather than your origin...

12 years ago | 0

| accepted

Answered
How to accept an answer in a comment?
I don't think you can accept a comment, but you can probably flag a comment for an editor. I think the answer you are referring...

12 years ago | 0

Answered
How to prevent Matlab from freezing when doc help is opened?
This was fixed in 2014a. There was a solution for 2013b that I read somewhere (though I'm afraid I can't remember where) whic...

12 years ago | 0

| accepted

Answered
How can I start my axis from 0 but keep the max limit automatic?
Probably not the neatest solution ( Azzi Abdelmalek's solution is better! ), but you could just use the auto limits each time yo...

12 years ago | 0

Answered
problem writing a seemingly easy summation
sum( P(2:end,:) )

12 years ago | 0

| accepted

Answered
find duplicate values, sort them and get their indices
rayPos15 = Ray( Position == 15 ); ampPos15 = Amplitude( Position == 15 ); [sortedRayPos15, idx] = sort( rayPos15 ); ...

12 years ago | 1

| accepted

Answered
Can't show grid in plot
If you set all the ticks to empty you will have no grid by definition as the grid is defined to be at the tick locations

12 years ago | 3

| accepted

Answered
in an assignment a(i) = b the number of elements in b and i must be the same
Your code works fine for me when I create a random matrix of 150*3, but it seems to me that the following code would better achi...

12 years ago | 0

Answered
logical operators in if statement
The logical expression you have won't cause your loop to end other than if it crashes as described by Iain. It will simply caus...

12 years ago | 0

Answered
Place blank entries by zeros
a( cellfun(@isempty,a(:,8)),8 ) = {0}

12 years ago | 2

| accepted

Answered
Simple problem with plotting
This is due to the fact that the centre of the first pixel is placed at 1, but it spans from 0.5 to 1.5, the second pixel from 1...

12 years ago | 0

Answered
Dividing up a word into letters based on the coordinates already present?
The first of your options would only work on a 4d matrix. The second would work if you swap round your indices - you have to ...

12 years ago | 0

| accepted

Answered
Interesting confusion in matlab - Number format
Use round rather than ceil when your result is so close to the integer you want. I have occasionally been caught by...

12 years ago | 0

Answered
How to make a function like eval ?
I would define as follows: Nx = 3; myFunc = @() 1 + 2*Nx then out = my_eval( myFunc, is_string ) would contai...

12 years ago | 0

Answered
is the result of "find" guaranteed to be sorted?
Yes, they are sorted

12 years ago | 0

Answered
How to add values through a for loop?
Just pre-size a vector before the for loop as e.g. result = zeros( 1, 7 ); then inside the for loop: result = resul...

12 years ago | 2

| accepted

Answered
nested function / Pass Data between 2 functions
set(Data,'buttondownfcn',{@ClickToDrag,Number}) should do the job. Incidentally, is 'handles' appearing in your ClickToD...

12 years ago | 1

Answered
Is it possible to represent a characteristic of an image as a single value?
If you need a single value for the whole image then mean, median and other similar statistics across all your pixel values will ...

12 years ago | 0

| accepted

Answered
replace one of many subplots
subplot(m,n,p) should set the next plotting axes to the one in position p of your (m,n) grid in the same way as it would h...

12 years ago | 1

| accepted

Answered
How to shuffle some arrays of a matrix?
a = a( randperm( numel(a) ) ) works assuming a is a vector

12 years ago | 1

Load more