답변 있음
Store variables in strings and invoke them
I would suggest that you use functions. You can store a variable name in a string, and use it, but its slower, and more like...

12년 초과 전 | 0

답변 있음
Perfect random numbers - How can I refine an initial dataset from randn to be perfrectly normal?
Hmmm: Take the inverse cdf, at regular intervals. rnds = icdf('norm',(1/samples):(1/samples):(1-1/samples), 0 , 1); Th...

12년 초과 전 | 0

답변 있음
Execution Time
Its more powerful to use "now" to get the current time than tic & toc, but it takes a bit more effort.

12년 초과 전 | 1

답변 있음
doing derivative using diff(Y)/dT makes the vector shorter
How I normally do it: average_slope_between_y1_and_y2 = diff(Y)./diff(t); middle_of_the_time_between_y1_and_y2 = (t(2:end)...

12년 초과 전 | 0

답변 있음
Can multiple vectors of differing data types be used in one object or matrix for a SOAP message
You can certainly have a cell array: mycell{1} = uint8([4 5 6]); mycell{2} = double([4 5 6]); mycell{3} = 'wibble wobble...

12년 초과 전 | 0

| 수락됨

답변 있음
Retrieve a variable previous value in the console
It may still be in the command history. If so you just need to look at the command history, and drag, (or select and hit enter o...

12년 초과 전 | 0

답변 있음
How to improve the code for vector calculation
Inner looop can be replaced by: PL_area4=P4(i).*B_area4(i,:).*P4(:); etc. The outer loop cannot be replaced unle...

12년 초과 전 | 0

답변 있음
Importing CSV files in MATLAB
[n, t, r] = xlsread(filename);

12년 초과 전 | 0

답변 있음
Reshape a cell avoiding the loop
I think: b = a'; c = reshape(b,cols,rows,numel(a)/cols/rows); c = permute(c,[2 1 3]); d = reshape(c,[],rows); shou...

12년 초과 전 | 0

| 수락됨

답변 있음
How can I connect the points in plot?
To draw a line, you need to always supply two points. Before the loop: t_prior = 0; ysag = 0; Just before the end: ...

12년 초과 전 | 0

답변 있음
Create .csv output with 'sheets' like excel?
Simple answer: No. CSVs are plain text files and there is way to split them into sheets. Complex answer: If you save a CSV p...

12년 초과 전 | 0

| 수락됨

답변 있음
i want to quantize the matrix values in terms of 0s and 1s...plz help me
General answer: b = a(:,vector_of_columns_i_want_to_keep) Specfic answers: b = a(:,[1 2]) b = a(:,1:2) b = a(:,1:...

12년 초과 전 | 0

| 수락됨

답변 있음
How do I add two columns to a matrix in ascending order?
x = repmat(x,numel(y),1) y = repmat(y,1,size(x,2)) A = [x(:) y(:)]

12년 초과 전 | 0

답변 있음
how to store or display some data from excel sheet in uitable created in GUI?
[n,t, r] = xlsread(filename,sheet, range...); substitute "r" for dat, uigetfile can be used to get the path and the filename...

12년 초과 전 | 0

답변 있음
Undefined variable error while using for loop.
for i = 1:whatever eval(['X_' num2str(i) ' = value;']) end What that does is set X_1, X_2, X_3, X_4... X_whatever equal...

12년 초과 전 | 2

답변 있음
problem after divide image
Sounds like either your number format is saturating. Cast the image as double or single before averaging. Alternatively u...

12년 초과 전 | 0

답변 있음
From command line, start editor immediately showing new function template
Not with a new function template, unless you generate one. Is it really a problem for you to add: function [result1, re...

12년 초과 전 | 0

답변 있음
Trouble Matching Data in Indexed Array
You can get the index of the matched item easily: index = find(strcmpi(elmnt,Accepted)); I find disp, and concatenation ...

12년 초과 전 | 0

답변 있음
How to exclude specific values from a vector?
C = setdiff(A,B);

12년 초과 전 | 8

| 수락됨

답변 있음
How does one create an array of strings in a loop? In a better way.
Once you have identified your word, you can simply put it in an element of a cell array thus: cell{index} = word; unique(c...

12년 초과 전 | 0

문제를 풀었습니다


Reverse the vector
Reverse the vector elements. Example: Input x = [1,2,3,4,5,6,7,8,9] Output y = [9,8,7,6,5,4,3,2,1]

12년 초과 전

문제를 풀었습니다


Too mean-spirited
Find the mean of each consecutive pair of numbers in the input row vector. For example, x=[1 2 3] ----> y = [1.5 2.5] x=[1...

12년 초과 전

문제를 풀었습니다


The Hitchhiker's Guide to MATLAB
Output logical "true" if the input is the answer to life, the universe and everything. Otherwise, output logical "false".

12년 초과 전

답변 있음
Accepting Multiple String Inputs
use strcmpi instead, if you want to make sure your user will type those strings as stated. put your "accepted" strings into a c...

12년 초과 전 | 0

| 수락됨

답변 있음
create a variable to store sets
Sounds like you need a cell array: S{set_no} = [2 3 5 6]; S(2} = [1 5 6 3 64 23];

12년 초과 전 | 0

| 수락됨

답변 있음
What does the expression mean that is included in question body
6/6/2013 23:55 ? You opened matlab at 5 to midnight last night?

12년 초과 전 | 0

문제를 풀었습니다


How to find the position of an element in a vector without using the find function
Write a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for. Examples: fin...

12년 초과 전

문제를 풀었습니다


Remove the vowels
Remove all the vowels in the given phrase. Example: Input s1 = 'Jack and Jill went up the hill' Output s2 is 'Jck nd Jll wn...

12년 초과 전

문제를 풀었습니다


Sum all integers from 1 to 2^n
Given the number x, y must be the summation of all integers from 1 to 2^x. For instance if x=2 then y must be 1+2+3+4=10.

12년 초과 전

답변 있음
How can i replace a matrix number with 0
A(1,3) = 0; A(3,3) = 0;

12년 초과 전 | 1

| 수락됨

더 보기